From 2b61dac97c0297bae6bc763c773817bdcc5c3353 Mon Sep 17 00:00:00 2001 From: mehdi-defiesta Date: Sat, 24 Jan 2026 14:22:02 +0100 Subject: [PATCH 1/3] feat: Replace TrivialAgent with canonical agent_main entrypoint ## Summary Replace the hardcoded TrivialAgent::run() call in kernel-guest with the canonical extern "Rust" fn agent_main(ctx, opaque_inputs) entrypoint. ## Key Changes ### API Design - Use `extern "Rust"` instead of `extern "C"` for ABI safety with Rust types - 2-argument signature: `agent_main(ctx: &AgentContext, opaque_inputs: &[u8])` - AgentContext uses owned fields (no lifetimes) - clean "header" struct ### New Crate: example-agent - Minimal example agent demonstrating the canonical entrypoint - Echoes input when opaque_inputs[0] == 1, empty output otherwise - Used for testing kernel execution flow ### Refactored Crates - kernel-sdk: AgentContext now uses owned [u8; 32] fields, 144 bytes fixed size - kernel-guest: Uses extern "Rust" block, no unsafe pointer casts needed - agent-traits: Re-exports from kernel-sdk, deprecated legacy Agent trait - host-tests: Added tests for agent_main behavior ## Technical Details - AgentContext is #[repr(C)], Clone, Copy, Debug, PartialEq, Eq - #[no_mangle] requires #[allow(unsafe_code)] due to Rust lint rules - All 88 host-tests pass, plus crate-specific tests --- Cargo.lock | 14 +- Cargo.toml | 1 + crates/agent-traits/Cargo.toml | 11 +- crates/agent-traits/src/lib.rs | 205 ++++++++++++------- crates/example-agent/Cargo.toml | 12 ++ crates/example-agent/src/lib.rs | 121 +++++++++++ crates/host-tests/Cargo.toml | 4 +- crates/host-tests/src/lib.rs | 194 ++++++++++++++++++ crates/kernel-guest/Cargo.toml | 10 +- crates/kernel-guest/src/lib.rs | 101 +++++++--- crates/kernel-sdk/examples/echo_agent.rs | 192 +++++++----------- crates/kernel-sdk/src/agent.rs | 244 +++++++---------------- crates/kernel-sdk/src/lib.rs | 16 +- 13 files changed, 722 insertions(+), 403 deletions(-) create mode 100644 crates/example-agent/Cargo.toml create mode 100644 crates/example-agent/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index bde78bf..ef72388 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7,6 +7,7 @@ name = "agent-traits" version = "0.1.0" dependencies = [ "kernel-core", + "kernel-sdk", ] [[package]] @@ -60,6 +61,13 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "example-agent" +version = "0.1.0" +dependencies = [ + "kernel-sdk", +] + [[package]] name = "generic-array" version = "0.14.7" @@ -74,10 +82,11 @@ dependencies = [ name = "host-tests" version = "0.1.0" dependencies = [ - "agent-traits", "constraints", + "example-agent", "kernel-core", "kernel-guest", + "kernel-sdk", "serde", "serde_json", ] @@ -99,9 +108,10 @@ dependencies = [ name = "kernel-guest" version = "0.1.0" dependencies = [ - "agent-traits", "constraints", + "example-agent", "kernel-core", + "kernel-sdk", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 8d91c68..4398428 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,7 @@ members = [ "crates/agent-traits", "crates/constraints", "crates/kernel-sdk", + "crates/example-agent", "crates/host-tests", ] diff --git a/crates/agent-traits/Cargo.toml b/crates/agent-traits/Cargo.toml index e306866..1579a15 100644 --- a/crates/agent-traits/Cargo.toml +++ b/crates/agent-traits/Cargo.toml @@ -2,6 +2,15 @@ name = "agent-traits" version = "0.1.0" edition = "2021" +description = "Agent ABI definitions and reference implementations" +license = "Apache-2.0" [dependencies] -kernel-core = { path = "../kernel-core" } \ No newline at end of file +kernel-core = { path = "../kernel-core" } +kernel-sdk = { path = "../kernel-sdk" } + +[features] +default = ["reference-agents"] +# Enable reference agent implementations (TrivialAgent, NoOpAgent, MultiActionAgent) +# These are useful for testing but should not be used in production +reference-agents = [] \ No newline at end of file diff --git a/crates/agent-traits/src/lib.rs b/crates/agent-traits/src/lib.rs index 49340f5..f00b957 100644 --- a/crates/agent-traits/src/lib.rs +++ b/crates/agent-traits/src/lib.rs @@ -1,11 +1,62 @@ -use kernel_core::{AgentOutput, ActionV1, AgentError, MAX_ACTIONS_PER_OUTPUT}; +//! Agent ABI Definitions and Reference Implementations +//! +//! This crate provides the canonical agent interface types and reference +//! implementations for testing. +//! +//! # Canonical Types (from kernel-sdk) +//! +//! - [`AgentContext`] - Execution context provided to agents +//! - [`AgentEntrypoint`] - Type alias for the canonical agent_main signature +//! - [`AgentOutput`] - Structured output containing ordered actions +//! +//! # Entrypoint Symbol +//! +//! The canonical entrypoint symbol name is defined by [`AGENT_ENTRYPOINT_SYMBOL`]. +//! All agents must expose exactly this function: +//! +//! ```ignore +//! #[no_mangle] +//! pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput +//! ``` +//! +//! # Reference Agents (feature: `reference-agents`) +//! +//! When the `reference-agents` feature is enabled (default), the following +//! test implementations are available: +//! +//! - [`TrivialAgent`] - Echoes input as a single action +//! - [`NoOpAgent`] - Produces no actions +//! - [`MultiActionAgent`] - Produces multiple actions for testing +//! +//! These are NOT production-ready and exist only for testing. -/// Context provided to agents during execution. +// Re-export canonical types from kernel-sdk +pub use kernel_sdk::agent::{AgentContext, AgentEntrypoint}; +pub use kernel_sdk::types::AgentOutput; + +/// Canonical entrypoint symbol name. +/// +/// All agents must export a function with this exact symbol name. +/// The kernel uses this symbol to locate the agent entrypoint. +pub const AGENT_ENTRYPOINT_SYMBOL: &str = "agent_main"; + +// ============================================================================ +// Legacy Types (for backward compatibility during transition) +// ============================================================================ + +use kernel_core::{ActionV1, AgentError, MAX_ACTIONS_PER_OUTPUT}; + +/// Legacy agent context (owned fields). /// -/// Contains all identity and state information the agent needs -/// to make decisions and produce actions. +/// **DEPRECATED**: Use [`AgentContext`] from kernel-sdk instead. +/// This type is kept for backward compatibility during the transition +/// to the canonical `agent_main` entrypoint. +#[deprecated( + since = "0.2.0", + note = "Use kernel_sdk::agent::AgentContext instead" +)] #[derive(Clone, Debug)] -pub struct AgentContext { +pub struct LegacyAgentContext { /// 32-byte agent identifier pub agent_id: [u8; 32], /// SHA-256 hash of the agent's own code @@ -18,92 +69,94 @@ pub struct AgentContext { pub execution_nonce: u64, } -/// Canonical agent interface. -/// -/// All agents must implement this trait. The kernel calls `run()` -/// with the execution context and opaque inputs, and expects -/// a structured `AgentOutput` containing ordered actions. +/// Legacy agent trait interface. /// -/// # Determinism Requirements -/// -/// Implementations MUST be fully deterministic: -/// - No randomness or time dependencies -/// - No floating-point operations -/// - No unordered iteration -/// - Bounded loops and memory usage +/// **DEPRECATED**: Implement `agent_main` function directly instead. +/// This trait is kept for backward compatibility during the transition. +#[deprecated( + since = "0.2.0", + note = "Implement extern \"Rust\" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput instead" +)] pub trait Agent { /// Execute the agent with the given context and inputs. - /// - /// # Arguments - /// * `ctx` - Execution context with identity and state information - /// * `inputs` - Opaque agent-specific input data - /// - /// # Returns - /// * `Ok(AgentOutput)` - Structured output containing ordered actions - /// * `Err(AgentError)` - Execution failed, kernel will abort - fn run(ctx: &AgentContext, inputs: &[u8]) -> Result; + fn run(ctx: &LegacyAgentContext, inputs: &[u8]) -> Result; } -/// Trivial reference agent implementation. -/// -/// WARNING: This is NOT production-ready and exists only for testing. -/// It converts input bytes into a single "echo" action. -pub struct TrivialAgent; +// ============================================================================ +// Reference Agent Implementations (behind feature flag) +// ============================================================================ + +#[cfg(feature = "reference-agents")] +mod reference_agents { + use super::*; -/// Action type for echo action (used by TrivialAgent) -pub const ACTION_TYPE_ECHO: u32 = 0x00000001; + /// Action type for echo action (used by TrivialAgent) + pub const ACTION_TYPE_ECHO: u32 = 0x00000001; -impl Agent for TrivialAgent { - /// Converts input into a single echo action. + /// Trivial reference agent implementation. /// - /// The action targets the agent's own ID and carries - /// the input as payload (truncated to max payload size). - fn run(ctx: &AgentContext, inputs: &[u8]) -> Result { - // Truncate to max payload size if needed - let payload_len = inputs.len().min(kernel_core::MAX_ACTION_PAYLOAD_BYTES); - let payload = inputs[..payload_len].to_vec(); - - let action = ActionV1 { - action_type: ACTION_TYPE_ECHO, - target: ctx.agent_id, - payload, - }; - - Ok(AgentOutput { - actions: vec![action], - }) + /// WARNING: This is NOT production-ready and exists only for testing. + /// It converts input bytes into a single "echo" action. + pub struct TrivialAgent; + + #[allow(deprecated)] + impl Agent for TrivialAgent { + /// Converts input into a single echo action. + /// + /// The action targets the agent's own ID and carries + /// the input as payload (truncated to max payload size). + fn run(ctx: &LegacyAgentContext, inputs: &[u8]) -> Result { + // Truncate to max payload size if needed + let payload_len = inputs.len().min(kernel_core::MAX_ACTION_PAYLOAD_BYTES); + let payload = inputs[..payload_len].to_vec(); + + let action = ActionV1 { + action_type: ACTION_TYPE_ECHO, + target: ctx.agent_id, + payload, + }; + + Ok(kernel_core::AgentOutput { + actions: vec![action], + }) + } } -} -/// No-op agent that produces no actions. -/// -/// Useful for testing constraint enforcement with empty output. -pub struct NoOpAgent; + /// No-op agent that produces no actions. + /// + /// Useful for testing constraint enforcement with empty output. + pub struct NoOpAgent; -impl Agent for NoOpAgent { - fn run(_ctx: &AgentContext, _inputs: &[u8]) -> Result { - Ok(AgentOutput { actions: vec![] }) + #[allow(deprecated)] + impl Agent for NoOpAgent { + fn run(_ctx: &LegacyAgentContext, _inputs: &[u8]) -> Result { + Ok(kernel_core::AgentOutput { actions: vec![] }) + } } -} -/// Agent that produces multiple actions for testing. -pub struct MultiActionAgent; + /// Agent that produces multiple actions for testing. + pub struct MultiActionAgent; -impl Agent for MultiActionAgent { - /// Produces one action per byte of input (up to MAX_ACTIONS_PER_OUTPUT). - fn run(ctx: &AgentContext, inputs: &[u8]) -> Result { - let action_count = inputs.len().min(MAX_ACTIONS_PER_OUTPUT); + #[allow(deprecated)] + impl Agent for MultiActionAgent { + /// Produces one action per byte of input (up to MAX_ACTIONS_PER_OUTPUT). + fn run(ctx: &LegacyAgentContext, inputs: &[u8]) -> Result { + let action_count = inputs.len().min(MAX_ACTIONS_PER_OUTPUT); - let actions: Vec = inputs[..action_count] - .iter() - .enumerate() - .map(|(i, &byte)| ActionV1 { - action_type: i as u32, - target: ctx.agent_id, - payload: vec![byte], - }) - .collect(); + let actions: Vec = inputs[..action_count] + .iter() + .enumerate() + .map(|(i, &byte)| ActionV1 { + action_type: i as u32, + target: ctx.agent_id, + payload: vec![byte], + }) + .collect(); - Ok(AgentOutput { actions }) + Ok(kernel_core::AgentOutput { actions }) + } } } + +#[cfg(feature = "reference-agents")] +pub use reference_agents::*; diff --git a/crates/example-agent/Cargo.toml b/crates/example-agent/Cargo.toml new file mode 100644 index 0000000..49e69b4 --- /dev/null +++ b/crates/example-agent/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "example-agent" +version = "0.1.0" +edition = "2021" +description = "Example agent implementation for testing the canonical agent_main entrypoint" +license = "Apache-2.0" + +[lib] +crate-type = ["rlib"] + +[dependencies] +kernel-sdk = { path = "../kernel-sdk" } diff --git a/crates/example-agent/src/lib.rs b/crates/example-agent/src/lib.rs new file mode 100644 index 0000000..81bbb4e --- /dev/null +++ b/crates/example-agent/src/lib.rs @@ -0,0 +1,121 @@ +//! Example Agent Implementation +//! +//! This crate provides a minimal example agent that demonstrates the canonical +//! `agent_main` entrypoint. It is used for testing the kernel's agent execution +//! flow. +//! +//! # Behavior +//! +//! The agent checks the first byte of `opaque_inputs`: +//! - If `opaque_inputs[0] == 1` → Echo action with full inputs as payload +//! - Otherwise → Empty output (no actions) +//! +//! This allows testing both action-producing and no-action execution paths. + +#![no_std] +// Use `deny` instead of `forbid` to allow targeted exception for #[no_mangle] +// The #[no_mangle] attribute is required for the canonical agent_main symbol, +// and triggers the unsafe_code lint because symbol collisions are UB. +#![deny(unsafe_code)] + +extern crate alloc; + +use kernel_sdk::prelude::*; + +/// Canonical agent entrypoint. +/// +/// This function is called by the kernel to execute the agent logic. +/// The symbol name `agent_main` is mandatory and fixed. +/// +/// # Arguments +/// +/// - `ctx`: Execution context with identity and metadata +/// - `opaque_inputs`: Agent-specific input data +/// +/// # Safety Note +/// +/// The `#[no_mangle]` attribute is required so the kernel can find this symbol. +/// The `unsafe_code` lint is allowed here because the symbol name is canonical +/// and expected by the kernel - there is no risk of collision. +#[no_mangle] +#[allow(unsafe_code)] +pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { + let should_echo = !opaque_inputs.is_empty() && opaque_inputs[0] == 1; + + if should_echo { + // Truncate to max payload size if needed + let payload_len = opaque_inputs.len().min(MAX_ACTION_PAYLOAD_BYTES); + let mut payload = Vec::with_capacity(payload_len); + payload.extend_from_slice(&opaque_inputs[..payload_len]); + + let action = echo_action(ctx.agent_id, payload); + + let mut actions = Vec::with_capacity(1); + actions.push(action); + AgentOutput { actions } + } else { + AgentOutput { actions: Vec::new() } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_agent_main_echo() { + let ctx = AgentContext { + protocol_version: 1, + kernel_version: 1, + agent_id: [0x42u8; 32], + agent_code_hash: [0xaau8; 32], + constraint_set_hash: [0xbbu8; 32], + input_root: [0xccu8; 32], + execution_nonce: 1, + }; + + let inputs = [1u8, 2, 3, 4, 5]; // First byte is 1 -> should echo + let output = agent_main(&ctx, &inputs); + + assert_eq!(output.actions.len(), 1); + assert_eq!(output.actions[0].action_type, ACTION_TYPE_ECHO); + assert_eq!(output.actions[0].target, ctx.agent_id); + assert_eq!(output.actions[0].payload, inputs.to_vec()); + } + + #[test] + fn test_agent_main_no_echo() { + let ctx = AgentContext { + protocol_version: 1, + kernel_version: 1, + agent_id: [0x42u8; 32], + agent_code_hash: [0xaau8; 32], + constraint_set_hash: [0xbbu8; 32], + input_root: [0xccu8; 32], + execution_nonce: 1, + }; + + let inputs = [0u8, 2, 3, 4, 5]; // First byte is 0 -> no echo + let output = agent_main(&ctx, &inputs); + + assert!(output.actions.is_empty()); + } + + #[test] + fn test_agent_main_empty_inputs() { + let ctx = AgentContext { + protocol_version: 1, + kernel_version: 1, + agent_id: [0x42u8; 32], + agent_code_hash: [0xaau8; 32], + constraint_set_hash: [0xbbu8; 32], + input_root: [0xccu8; 32], + execution_nonce: 1, + }; + + let inputs: [u8; 0] = []; // Empty -> no echo + let output = agent_main(&ctx, &inputs); + + assert!(output.actions.is_empty()); + } +} diff --git a/crates/host-tests/Cargo.toml b/crates/host-tests/Cargo.toml index 350ad70..415eef8 100644 --- a/crates/host-tests/Cargo.toml +++ b/crates/host-tests/Cargo.toml @@ -6,8 +6,10 @@ edition = "2021" [dependencies] kernel-core = { path = "../kernel-core", features = ["std"] } kernel-guest = { path = "../kernel-guest" } -agent-traits = { path = "../agent-traits" } +kernel-sdk = { path = "../kernel-sdk" } constraints = { path = "../constraints" } +# example-agent provides the agent_main symbol required by kernel-guest +example-agent = { path = "../example-agent" } [dev-dependencies] serde = { version = "1.0", features = ["derive"] } diff --git a/crates/host-tests/src/lib.rs b/crates/host-tests/src/lib.rs index ddf2a15..ce67516 100644 --- a/crates/host-tests/src/lib.rs +++ b/crates/host-tests/src/lib.rs @@ -1,3 +1,8 @@ +// Force linking of example-agent to provide the agent_main symbol +// This is required because kernel-guest declares an extern "C" fn agent_main +// which must be provided by a linked agent crate. +extern crate example_agent; + #[cfg(test)] mod tests { use kernel_core::*; @@ -7,6 +12,7 @@ mod tests { ensure_no_trailing_bytes, }; use kernel_guest::kernel_main; + use constraints::EMPTY_OUTPUT_COMMITMENT; /// Helper to create a valid KernelInputV1 with default values fn make_input(agent_input: Vec) -> KernelInputV1 { @@ -1767,6 +1773,194 @@ mod tests { assert_eq!(violation.reason, ConstraintViolationReason::InvalidStateSnapshot); } + // ======================================================================== + // P0.4: Canonical agent_main Entrypoint Tests + // ======================================================================== + + #[test] + fn test_agent_main_echo_success() { + // When opaque_inputs[0] == 1, the example-agent produces an echo action + // which should result in SUCCESS status + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xaa; 32], + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 1, + opaque_agent_inputs: vec![1, 2, 3, 4, 5], // First byte is 1 -> echo + }; + + let input_bytes = input.encode().unwrap(); + let journal_bytes = kernel_main(&input_bytes).unwrap(); + let journal = KernelJournalV1::decode(&journal_bytes).unwrap(); + + // Verify SUCCESS status + assert_eq!(journal.execution_status, ExecutionStatus::Success); + + // Verify identity fields are preserved + assert_eq!(journal.agent_id, [0x42; 32]); + assert_eq!(journal.agent_code_hash, [0xaa; 32]); + assert_eq!(journal.constraint_set_hash, [0xbb; 32]); + assert_eq!(journal.input_root, [0xcc; 32]); + assert_eq!(journal.execution_nonce, 1); + + // Action commitment should NOT be the empty output commitment + assert_ne!(journal.action_commitment, EMPTY_OUTPUT_COMMITMENT); + } + + #[test] + fn test_agent_main_no_echo_empty_output() { + // When opaque_inputs[0] != 1, the example-agent produces no actions + // which should still result in SUCCESS status (empty output is valid) + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xaa; 32], + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 2, + opaque_agent_inputs: vec![0, 2, 3, 4, 5], // First byte is 0 -> no echo + }; + + let input_bytes = input.encode().unwrap(); + let journal_bytes = kernel_main(&input_bytes).unwrap(); + let journal = KernelJournalV1::decode(&journal_bytes).unwrap(); + + // Verify SUCCESS status (empty output is valid) + assert_eq!(journal.execution_status, ExecutionStatus::Success); + + // Action commitment should be the empty output commitment + assert_eq!(journal.action_commitment, EMPTY_OUTPUT_COMMITMENT); + } + + #[test] + fn test_agent_main_empty_inputs_no_echo() { + // Empty opaque_inputs should result in no actions + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xaa; 32], + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 3, + opaque_agent_inputs: vec![], // Empty -> no echo + }; + + let input_bytes = input.encode().unwrap(); + let journal_bytes = kernel_main(&input_bytes).unwrap(); + let journal = KernelJournalV1::decode(&journal_bytes).unwrap(); + + // Verify SUCCESS status + assert_eq!(journal.execution_status, ExecutionStatus::Success); + + // Action commitment should be the empty output commitment + assert_eq!(journal.action_commitment, EMPTY_OUTPUT_COMMITMENT); + } + + #[test] + fn test_agent_main_echo_commitment_verification() { + // Verify that the action commitment is correctly computed for echo action + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xaa; 32], + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 4, + opaque_agent_inputs: vec![1, 0xde, 0xad, 0xbe, 0xef], // First byte is 1 -> echo + }; + + let input_bytes = input.encode().unwrap(); + let journal_bytes = kernel_main(&input_bytes).unwrap(); + let journal = KernelJournalV1::decode(&journal_bytes).unwrap(); + + assert_eq!(journal.execution_status, ExecutionStatus::Success); + + // Manually compute expected action commitment + // The example-agent creates an echo action with: + // - action_type = 0x00000001 (ECHO) + // - target = agent_id = [0x42; 32] + // - payload = opaque_inputs = [1, 0xde, 0xad, 0xbe, 0xef] + let expected_action = ActionV1 { + action_type: 0x00000001, // ACTION_TYPE_ECHO + target: [0x42; 32], + payload: vec![1, 0xde, 0xad, 0xbe, 0xef], + }; + let expected_output = AgentOutput { + actions: vec![expected_action], + }; + let expected_output_bytes = expected_output.encode().unwrap(); + let expected_commitment = compute_action_commitment(&expected_output_bytes); + + assert_eq!(journal.action_commitment, expected_commitment); + } + + #[test] + fn test_agent_main_determinism() { + // Verify that the same input produces the same output + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x11; 32], + agent_code_hash: [0x22; 32], + constraint_set_hash: [0x33; 32], + input_root: [0x44; 32], + execution_nonce: 100, + opaque_agent_inputs: vec![1, 0xff, 0xee, 0xdd], + }; + + let input_bytes = input.encode().unwrap(); + + // Run multiple times + let result1 = kernel_main(&input_bytes).unwrap(); + let result2 = kernel_main(&input_bytes).unwrap(); + let result3 = kernel_main(&input_bytes).unwrap(); + + // All results should be identical + assert_eq!(result1, result2); + assert_eq!(result2, result3); + } + + #[test] + fn test_constraint_violation_with_agent_main() { + // Test that constraint violations are properly handled with the new agent_main flow + // Use a constraint set that rejects the echo action by limiting max_actions_per_output to 0 + use constraints::ConstraintSetV1; + use kernel_guest::kernel_main_with_constraints; + + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xaa; 32], + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 5, + opaque_agent_inputs: vec![1, 2, 3], // First byte is 1 -> echo (produces 1 action) + }; + + // Constraint set that only allows 0 actions + let constraints = ConstraintSetV1 { + max_actions_per_output: 0, // This will reject any non-empty output + ..ConstraintSetV1::default() + }; + + let input_bytes = input.encode().unwrap(); + let journal_bytes = kernel_main_with_constraints(&input_bytes, &constraints).unwrap(); + let journal = KernelJournalV1::decode(&journal_bytes).unwrap(); + + // Verify FAILURE status due to constraint violation + assert_eq!(journal.execution_status, ExecutionStatus::Failure); + + // On failure, action commitment should be the empty output commitment + assert_eq!(journal.action_commitment, EMPTY_OUTPUT_COMMITMENT); + } + // ======================================================================== // Test Helpers // ======================================================================== diff --git a/crates/kernel-guest/Cargo.toml b/crates/kernel-guest/Cargo.toml index 86b95a0..5189c28 100644 --- a/crates/kernel-guest/Cargo.toml +++ b/crates/kernel-guest/Cargo.toml @@ -2,12 +2,16 @@ name = "kernel-guest" version = "0.1.0" edition = "2021" +description = "Kernel guest execution logic with agent_main entrypoint" +license = "Apache-2.0" [dependencies] kernel-core = { path = "../kernel-core", default-features = false } -agent-traits = { path = "../agent-traits" } +kernel-sdk = { path = "../kernel-sdk" } constraints = { path = "../constraints" } +example-agent = { path = "../example-agent", optional = true } [features] -default = [] -risc0 = [] \ No newline at end of file +default = ["example-agent"] +risc0 = [] +example-agent = ["dep:example-agent"] \ No newline at end of file diff --git a/crates/kernel-guest/src/lib.rs b/crates/kernel-guest/src/lib.rs index 3a06d07..3a9b193 100644 --- a/crates/kernel-guest/src/lib.rs +++ b/crates/kernel-guest/src/lib.rs @@ -1,14 +1,63 @@ +//! Kernel Guest Execution Logic +//! +//! This crate implements the core kernel execution logic that runs inside +//! the zkVM guest. It orchestrates agent execution through the canonical +//! `agent_main` entrypoint. +//! +//! # Execution Flow +//! +//! 1. Decode input bytes → `KernelInputV1` +//! 2. Validate protocol and kernel versions +//! 3. Compute input commitment (SHA256) +//! 4. Build `AgentContext` from kernel input +//! 5. Call `agent_main` via `extern "Rust"` ABI +//! 6. Enforce constraints on agent output (UNSKIPPABLE) +//! 7. Compute action commitment (SHA256) +//! 8. Return encoded `KernelJournalV1` +//! +//! # Agent Entrypoint +//! +//! The agent is invoked through an `extern "Rust"` function with the symbol +//! `agent_main`. This function is linked at compile time (for static +//! agents like `example-agent`) or at load time (for dynamic agents). + use kernel_core::*; -use agent_traits::{Agent, AgentContext, TrivialAgent}; +use kernel_sdk::agent::AgentContext; use constraints::{enforce_constraints, ConstraintSetV1, EMPTY_OUTPUT_COMMITMENT}; +// ============================================================================ +// Agent Entrypoint Declaration +// ============================================================================ + +// The agent_main function is provided by the linked agent crate. +// For example, when the `example-agent` feature is enabled, the +// example_agent::agent_main function is linked. +// +// Using `extern "Rust"` is safe for Rust types like &AgentContext and +// AgentOutput (which contains Vec). This avoids the ABI-safety issues +// that would arise with `extern "C"`. +extern "Rust" { + fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput; +} + +/// Safe wrapper for calling the agent entrypoint. +#[inline] +fn call_agent(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { + // Safe: extern "Rust" guarantees correct ABI for Rust types + unsafe { agent_main(ctx, opaque_inputs) } +} + +// ============================================================================ +// Main Kernel Execution +// ============================================================================ + /// Main kernel execution function. /// /// This is the core execution logic that: /// 1. Decodes and validates input /// 2. Verifies protocol and kernel versions /// 3. Computes input commitment -/// 4. Executes the agent +/// 4. Executes the agent via `agent_main` /// 5. Enforces constraints on agent output (UNSKIPPABLE) /// 6. Computes action commitment /// 7. Constructs and returns the journal @@ -59,18 +108,19 @@ pub fn kernel_main(input_bytes: &[u8]) -> Result, KernelError> { // 3. Compute input commitment (over full input bytes) let input_commitment = compute_input_commitment(input_bytes); - // 4. Build agent context from input - let agent_ctx = AgentContext { - agent_id: input.agent_id, - agent_code_hash: input.agent_code_hash, - constraint_set_hash: input.constraint_set_hash, - input_root: input.input_root, - execution_nonce: input.execution_nonce, - }; + // 4. Build agent context from input (using kernel-sdk AgentContext) + let agent_ctx = AgentContext::new( + input.protocol_version, + input.kernel_version, + input.agent_id, + input.agent_code_hash, + input.constraint_set_hash, + input.input_root, + input.execution_nonce, + ); - // 5. Execute agent - let agent_output = TrivialAgent::run(&agent_ctx, &input.opaque_agent_inputs) - .map_err(KernelError::AgentExecutionFailed)?; + // 5. Execute agent via canonical agent_main entrypoint + let agent_output = call_agent(&agent_ctx, &input.opaque_agent_inputs); // 6. Get constraint set (P0.3: use default permissive constraints) let constraint_set = ConstraintSetV1::default(); @@ -151,18 +201,19 @@ pub fn kernel_main_with_constraints( // 3. Compute input commitment let input_commitment = compute_input_commitment(input_bytes); - // 4. Build agent context - let agent_ctx = AgentContext { - agent_id: input.agent_id, - agent_code_hash: input.agent_code_hash, - constraint_set_hash: input.constraint_set_hash, - input_root: input.input_root, - execution_nonce: input.execution_nonce, - }; - - // 5. Execute agent - let agent_output = TrivialAgent::run(&agent_ctx, &input.opaque_agent_inputs) - .map_err(KernelError::AgentExecutionFailed)?; + // 4. Build agent context (using kernel-sdk AgentContext) + let agent_ctx = AgentContext::new( + input.protocol_version, + input.kernel_version, + input.agent_id, + input.agent_code_hash, + input.constraint_set_hash, + input.input_root, + input.execution_nonce, + ); + + // 5. Execute agent via canonical agent_main entrypoint + let agent_output = call_agent(&agent_ctx, &input.opaque_agent_inputs); // 6. ENFORCE CONSTRAINTS (UNSKIPPABLE) let (validated_output, execution_status) = diff --git a/crates/kernel-sdk/examples/echo_agent.rs b/crates/kernel-sdk/examples/echo_agent.rs index 12ba1a6..e2e73d7 100644 --- a/crates/kernel-sdk/examples/echo_agent.rs +++ b/crates/kernel-sdk/examples/echo_agent.rs @@ -11,7 +11,7 @@ //! //! # Behavior //! -//! 1. Receives `AgentContext` from the kernel +//! 1. Receives `AgentContext` and `opaque_inputs` from the kernel //! 2. Creates a single `Echo` action //! 3. Uses `agent_id` as the target //! 4. Uses `opaque_inputs` as the payload (truncated to max size) @@ -33,14 +33,19 @@ use kernel_sdk::prelude::*; /// Canonical agent entrypoint. /// -/// This function is called by the kernel with the execution context. -/// It must return an `AgentOutput` containing zero or more actions. +/// This function is called by the kernel with the execution context +/// and opaque inputs. /// /// # Symbol Requirements /// /// - Name must be exactly `agent_main` /// - Must use `#[no_mangle]` to prevent name mangling -/// - Must use `extern "C"` for C ABI compatibility +/// - Must use `extern "Rust"` for safe Rust ABI +/// +/// # Arguments +/// +/// - `ctx`: Execution context with identity and metadata +/// - `opaque_inputs`: Agent-specific input data /// /// # Panic Behavior /// @@ -52,8 +57,7 @@ use kernel_sdk::prelude::*; /// Agents should handle errors gracefully and return empty outputs /// rather than panicking when possible. #[no_mangle] -#[allow(improper_ctypes_definitions)] // AgentOutput uses zkVM ABI, not literal C FFI -pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput { +pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { // Validate kernel version (optional but recommended) if !ctx.is_kernel_v1() { // Return empty output for unsupported versions @@ -63,17 +67,17 @@ pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput { // Truncate payload to max size if needed let max_payload = kernel_sdk::types::MAX_ACTION_PAYLOAD_BYTES; - let payload_len = if ctx.opaque_inputs.len() > max_payload { + let payload_len = if opaque_inputs.len() > max_payload { max_payload } else { - ctx.opaque_inputs.len() + opaque_inputs.len() }; // Create the echo action let action = ActionV1 { action_type: ACTION_TYPE_ECHO, - target: *ctx.agent_id, - payload: ctx.opaque_inputs[..payload_len].to_vec(), + target: ctx.agent_id, + payload: opaque_inputs[..payload_len].to_vec(), }; // Return the output @@ -90,7 +94,7 @@ pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput { /// /// Useful for testing constraint enforcement with empty outputs. #[allow(dead_code)] -fn noop_agent(_ctx: &AgentContext) -> AgentOutput { +fn noop_agent(_ctx: &AgentContext, _opaque_inputs: &[u8]) -> AgentOutput { AgentOutput { actions: vec![] } } @@ -98,19 +102,19 @@ fn noop_agent(_ctx: &AgentContext) -> AgentOutput { /// /// Demonstrates bounded iteration and multiple action production. #[allow(dead_code)] -fn multi_echo_agent(ctx: &AgentContext) -> AgentOutput { +fn multi_echo_agent(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { // Limit to MAX_ACTIONS_PER_OUTPUT actions - let action_count = if ctx.opaque_inputs.len() > MAX_ACTIONS_PER_OUTPUT { + let action_count = if opaque_inputs.len() > MAX_ACTIONS_PER_OUTPUT { MAX_ACTIONS_PER_OUTPUT } else { - ctx.opaque_inputs.len() + opaque_inputs.len() }; - let actions: Vec = ctx.opaque_inputs[..action_count] + let actions: Vec = opaque_inputs[..action_count] .iter() .map(|&byte| ActionV1 { action_type: ACTION_TYPE_ECHO, - target: *ctx.agent_id, + target: ctx.agent_id, payload: vec![byte], }) .collect(); @@ -122,31 +126,31 @@ fn multi_echo_agent(ctx: &AgentContext) -> AgentOutput { /// /// Demonstrates use of the SDK's action constructors. #[allow(dead_code)] -fn trading_agent(ctx: &AgentContext) -> AgentOutput { +fn trading_agent(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { // Need at least 41 bytes: asset_id (32) + notional (8) + direction (1) - if ctx.opaque_inputs.len() < 41 { + if opaque_inputs.len() < 41 { return AgentOutput { actions: vec![] }; } // Parse inputs using SDK byte helpers - let asset_id = match kernel_sdk::bytes::read_bytes32(ctx.opaque_inputs, 0) { + let asset_id = match kernel_sdk::bytes::read_bytes32(opaque_inputs, 0) { Some(id) => id, None => return AgentOutput { actions: vec![] }, }; - let notional = match kernel_sdk::bytes::read_u64_le(ctx.opaque_inputs, 32) { + let notional = match kernel_sdk::bytes::read_u64_le(opaque_inputs, 32) { Some(n) => n, None => return AgentOutput { actions: vec![] }, }; - let direction = match kernel_sdk::bytes::read_u8(ctx.opaque_inputs, 40) { + let direction = match kernel_sdk::bytes::read_u8(opaque_inputs, 40) { Some(d) => d, None => return AgentOutput { actions: vec![] }, }; // Create open position action using SDK helper let action = open_position_action( - *ctx.agent_id, // target: self + ctx.agent_id, // target: self asset_id, notional, 10_000, // 1x leverage @@ -168,24 +172,18 @@ fn trading_agent(ctx: &AgentContext) -> AgentOutput { /// This exists only to allow the example to compile as a standalone binary. fn main() { // Create a mock context for demonstration - let agent_id = [0x42u8; 32]; - let code_hash = [0xaau8; 32]; - let constraint_hash = [0xbbu8; 32]; - let input_root = [0xccu8; 32]; - let inputs = [1u8, 2, 3, 4, 5]; - let ctx = AgentContext::new( 1, 1, - &agent_id, - &code_hash, - &constraint_hash, - &input_root, + [0x42u8; 32], + [0xaau8; 32], + [0xbbu8; 32], + [0xccu8; 32], 12345, - &inputs, ); - let output = agent_main(&ctx); + let inputs = [1u8, 2, 3, 4, 5]; + let output = agent_main(&ctx, &inputs); println!("Agent produced {} action(s)", output.actions.len()); } @@ -197,13 +195,12 @@ fn main() { mod tests { use super::*; - fn make_test_context<'a>( - agent_id: &'a [u8; 32], - code_hash: &'a [u8; 32], - constraint_hash: &'a [u8; 32], - input_root: &'a [u8; 32], - inputs: &'a [u8], - ) -> AgentContext<'a> { + fn make_test_context( + agent_id: [u8; 32], + code_hash: [u8; 32], + constraint_hash: [u8; 32], + input_root: [u8; 32], + ) -> AgentContext { AgentContext::new( 1, // protocol_version 1, // kernel_version @@ -212,51 +209,38 @@ mod tests { constraint_hash, input_root, 12345, // execution_nonce - inputs, ) } #[test] fn test_echo_agent_basic() { - let agent_id = [0x42u8; 32]; - let code_hash = [0xaau8; 32]; - let constraint_hash = [0xbbu8; 32]; - let input_root = [0xccu8; 32]; - let inputs = [1u8, 2, 3, 4, 5]; - let ctx = make_test_context( - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - &inputs, + [0x42u8; 32], + [0xaau8; 32], + [0xbbu8; 32], + [0xccu8; 32], ); + let inputs = [1u8, 2, 3, 4, 5]; - let output = agent_main(&ctx); + let output = agent_main(&ctx, &inputs); assert_eq!(output.actions.len(), 1); assert_eq!(output.actions[0].action_type, ACTION_TYPE_ECHO); - assert_eq!(output.actions[0].target, agent_id); + assert_eq!(output.actions[0].target, [0x42u8; 32]); assert_eq!(output.actions[0].payload, vec![1, 2, 3, 4, 5]); } #[test] fn test_echo_agent_empty_input() { - let agent_id = [0x42u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - let inputs: [u8; 0] = []; - let ctx = make_test_context( - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - &inputs, + [0x42u8; 32], + [0u8; 32], + [0u8; 32], + [0u8; 32], ); + let inputs: [u8; 0] = []; - let output = agent_main(&ctx); + let output = agent_main(&ctx, &inputs); assert_eq!(output.actions.len(), 1); assert_eq!(output.actions[0].payload.len(), 0); @@ -264,41 +248,29 @@ mod tests { #[test] fn test_noop_agent() { - let agent_id = [0u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - let inputs = [1u8, 2, 3]; - let ctx = make_test_context( - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - &inputs, + [0u8; 32], + [0u8; 32], + [0u8; 32], + [0u8; 32], ); + let inputs = [1u8, 2, 3]; - let output = noop_agent(&ctx); + let output = noop_agent(&ctx, &inputs); assert_eq!(output.actions.len(), 0); } #[test] fn test_multi_echo_agent() { - let agent_id = [0x42u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - let inputs = [1u8, 2, 3, 4, 5]; - let ctx = make_test_context( - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - &inputs, + [0x42u8; 32], + [0u8; 32], + [0u8; 32], + [0u8; 32], ); + let inputs = [1u8, 2, 3, 4, 5]; - let output = multi_echo_agent(&ctx); + let output = multi_echo_agent(&ctx, &inputs); assert_eq!(output.actions.len(), 5); for (i, action) in output.actions.iter().enumerate() { @@ -309,10 +281,12 @@ mod tests { #[test] fn test_trading_agent_valid_input() { - let agent_id = [0x11u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; + let ctx = make_test_context( + [0x11u8; 32], + [0u8; 32], + [0u8; 32], + [0u8; 32], + ); // Build input: asset_id (32) + notional (8) + direction (1) let mut inputs = Vec::with_capacity(41); @@ -320,15 +294,7 @@ mod tests { inputs.extend_from_slice(&1000u64.to_le_bytes()); // notional inputs.push(0); // direction = long - let ctx = make_test_context( - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - &inputs, - ); - - let output = trading_agent(&ctx); + let output = trading_agent(&ctx, &inputs); assert_eq!(output.actions.len(), 1); assert_eq!(output.actions[0].action_type, ACTION_TYPE_OPEN_POSITION); @@ -336,21 +302,15 @@ mod tests { #[test] fn test_trading_agent_invalid_input() { - let agent_id = [0x11u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - let inputs = [1u8, 2, 3]; // Too short - let ctx = make_test_context( - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - &inputs, + [0x11u8; 32], + [0u8; 32], + [0u8; 32], + [0u8; 32], ); + let inputs = [1u8, 2, 3]; // Too short - let output = trading_agent(&ctx); + let output = trading_agent(&ctx, &inputs); assert_eq!(output.actions.len(), 0); // Graceful degradation } } diff --git a/crates/kernel-sdk/src/agent.rs b/crates/kernel-sdk/src/agent.rs index c7df5ae..4f13c97 100644 --- a/crates/kernel-sdk/src/agent.rs +++ b/crates/kernel-sdk/src/agent.rs @@ -1,7 +1,8 @@ //! Agent context and entrypoint definitions. //! //! This module defines the canonical agent interface used by the kernel. -//! Agents receive an [`AgentContext`] and must return an [`AgentOutput`]. +//! Agents receive an [`AgentContext`] and opaque inputs, and must return +//! an [`AgentOutput`]. //! //! # Canonical Entrypoint //! @@ -9,10 +10,11 @@ //! //! ```ignore //! #[no_mangle] -//! pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput +//! pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput //! ``` //! //! - The symbol name `agent_main` is fixed and mandatory +//! - Uses `extern "Rust"` for safe ABI with Rust types //! - No other entrypoints are recognized by the kernel //! - Panics abort execution and invalidate the proof //! @@ -22,9 +24,9 @@ //! use kernel_sdk::prelude::*; //! //! #[no_mangle] -//! pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput { +//! pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { //! // Pure, deterministic logic only -//! AgentOutput { actions: vec![] } +//! AgentOutput { actions: Vec::new() } //! } //! ``` @@ -32,20 +34,20 @@ use crate::types::AgentOutput; /// Execution context provided to agents by the kernel. /// -/// This structure contains all information an agent needs to make decisions -/// and produce actions. All fields are immutable and pre-validated by the kernel. +/// This structure contains all identity and metadata information an agent +/// needs to make decisions. The actual input data is passed separately +/// as `opaque_inputs` to the entrypoint. /// -/// # ABI Stability +/// # Design Rationale /// -/// This struct uses `#[repr(C)]` to ensure a stable, predictable memory layout -/// across crate versions and compiler updates. This is required because the -/// canonical entrypoint uses `extern "C"` ABI. +/// - All fields are owned/Copy types (no lifetimes) +/// - `opaque_inputs` is passed as a separate argument to the entrypoint +/// - This keeps the context a clean "header" structure /// -/// # Immutability +/// # ABI Stability /// -/// - All fields are references or Copy types -/// - No interior mutability is permitted -/// - Agents cannot modify the context +/// This struct uses `#[repr(C)]` to ensure a stable, predictable memory layout +/// across crate versions and compiler updates. /// /// # Validation /// @@ -53,14 +55,9 @@ use crate::types::AgentOutput; /// - Protocol and kernel versions are supported /// - Identifiers and hashes are correctly formatted /// - Size limits are enforced -/// -/// # Lifetime -/// -/// The `'a` lifetime is tied to the kernel's input buffer. The context -/// is valid for the duration of the `agent_main` call. #[repr(C)] -#[derive(Clone, Debug)] -pub struct AgentContext<'a> { +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct AgentContext { /// Protocol version for wire format compatibility. /// /// Currently must be 1. Agents can check this to ensure compatibility. @@ -76,71 +73,47 @@ pub struct AgentContext<'a> { /// /// Uniquely identifies this agent within the protocol. /// Commonly used as the default target for actions. - pub agent_id: &'a [u8; 32], + pub agent_id: [u8; 32], /// SHA-256 hash of the agent binary. /// /// The proof binds to this specific agent code. /// Agents can use this to verify they are running expected code. - pub agent_code_hash: &'a [u8; 32], + pub agent_code_hash: [u8; 32], /// SHA-256 hash of the constraint set being enforced. /// /// Identifies the economic safety rules applied to this execution. /// Agents can use this to adjust behavior based on constraint policy. - pub constraint_set_hash: &'a [u8; 32], + pub constraint_set_hash: [u8; 32], /// External state root (market/vault snapshot). /// /// Merkle root or hash of the external state the agent observes. /// The proof binds to this specific state snapshot. - pub input_root: &'a [u8; 32], + pub input_root: [u8; 32], /// Monotonic nonce for replay protection. /// /// Must be strictly increasing across executions for the same agent. /// Used by the settlement layer to prevent replay attacks. pub execution_nonce: u64, - - /// Opaque agent-specific input data. - /// - /// This byte slice contains agent-defined data. The kernel does not - /// interpret this data beyond size validation (max 64,000 bytes). - /// - /// # Snapshot Prefix Convention - /// - /// If cooldown or drawdown constraints are enabled, the **first 36 bytes** - /// of `opaque_inputs` must contain a `StateSnapshotV1`: - /// - /// | Offset | Field | Type | Size | - /// |--------|-------------------|------|------| - /// | 0 | snapshot_version | u32 | 4 | - /// | 4 | last_execution_ts | u64 | 8 | - /// | 12 | current_ts | u64 | 8 | - /// | 20 | current_equity | u64 | 8 | - /// | 28 | peak_equity | u64 | 8 | - /// - /// Any bytes after the first 36 are agent-specific and ignored by the - /// constraint engine. See `spec/constraints.md` for full details. - pub opaque_inputs: &'a [u8], } -impl<'a> AgentContext<'a> { +impl AgentContext { /// Create a new AgentContext from kernel input data. /// /// This is called by the kernel, not by agents. /// Agents receive the context as a parameter to `agent_main`. #[doc(hidden)] - #[allow(clippy::too_many_arguments)] // Intentional: matches kernel input structure pub fn new( protocol_version: u32, kernel_version: u32, - agent_id: &'a [u8; 32], - agent_code_hash: &'a [u8; 32], - constraint_set_hash: &'a [u8; 32], - input_root: &'a [u8; 32], + agent_id: [u8; 32], + agent_code_hash: [u8; 32], + constraint_set_hash: [u8; 32], + input_root: [u8; 32], execution_nonce: u64, - opaque_inputs: &'a [u8], ) -> Self { Self { protocol_version, @@ -150,7 +123,6 @@ impl<'a> AgentContext<'a> { constraint_set_hash, input_root, execution_nonce, - opaque_inputs, } } @@ -169,53 +141,39 @@ impl<'a> AgentContext<'a> { pub fn is_kernel_v1(&self) -> bool { self.kernel_version == 1 } - - /// Get the length of opaque inputs. - #[inline] - pub fn inputs_len(&self) -> usize { - self.opaque_inputs.len() - } - - /// Check if opaque inputs is empty. - #[inline] - pub fn inputs_is_empty(&self) -> bool { - self.opaque_inputs.is_empty() - } - - /// Check if opaque inputs contains at least a state snapshot prefix. - /// - /// Returns true if `opaque_inputs.len() >= 36`. - #[inline] - pub fn has_snapshot_prefix(&self) -> bool { - self.opaque_inputs.len() >= 36 - } - - /// Get the agent-specific portion of opaque inputs (bytes after snapshot). - /// - /// Returns the bytes after the 36-byte snapshot prefix, or the full - /// slice if shorter than 36 bytes. - #[inline] - pub fn agent_inputs(&self) -> &[u8] { - if self.opaque_inputs.len() > 36 { - &self.opaque_inputs[36..] - } else { - &[] - } - } } /// Type alias for the canonical agent entrypoint function. /// /// Agents must implement a function with this signature and expose it -/// with `#[no_mangle] pub extern "C"` and the name `agent_main`. +/// with `#[no_mangle]` and the name `agent_main`. +/// +/// # Signature /// -/// The lifetime parameter `'a` is tied to the kernel's input buffer. +/// ```ignore +/// fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput +/// ``` /// -/// Note: `AgentOutput` is not FFI-safe (no `#[repr(C)]`), but this is -/// acceptable because zkVM guest execution uses its own ABI mechanisms -/// rather than literal C FFI. -#[allow(improper_ctypes_definitions)] -pub type AgentEntrypoint<'a> = extern "C" fn(&AgentContext<'a>) -> AgentOutput; +/// - `ctx`: Execution context with identity and metadata +/// - `opaque_inputs`: Agent-specific input data (max 64,000 bytes) +/// - Returns: `AgentOutput` containing ordered actions +/// +/// # Opaque Inputs Convention +/// +/// If cooldown or drawdown constraints are enabled, the **first 36 bytes** +/// of `opaque_inputs` must contain a `StateSnapshotV1`: +/// +/// | Offset | Field | Type | Size | +/// |--------|-------------------|------|------| +/// | 0 | snapshot_version | u32 | 4 | +/// | 4 | last_execution_ts | u64 | 8 | +/// | 12 | current_ts | u64 | 8 | +/// | 20 | current_equity | u64 | 8 | +/// | 28 | peak_equity | u64 | 8 | +/// +/// Any bytes after the first 36 are agent-specific and ignored by the +/// constraint engine. See `spec/constraints.md` for full details. +pub type AgentEntrypoint = extern "Rust" fn(&AgentContext, &[u8]) -> AgentOutput; #[cfg(test)] mod tests { @@ -223,104 +181,46 @@ mod tests { #[test] fn test_agent_context_creation() { - let agent_id = [0x42u8; 32]; - let code_hash = [0xaau8; 32]; - let constraint_hash = [0xbbu8; 32]; - let input_root = [0xccu8; 32]; - let inputs = [1u8, 2, 3, 4, 5]; - let ctx = AgentContext::new( 1, 1, - &agent_id, - &code_hash, - &constraint_hash, - &input_root, + [0x42u8; 32], + [0xaau8; 32], + [0xbbu8; 32], + [0xccu8; 32], 12345, - &inputs, ); assert_eq!(ctx.protocol_version, 1); assert_eq!(ctx.kernel_version, 1); - assert_eq!(ctx.agent_id, &agent_id); + assert_eq!(ctx.agent_id, [0x42u8; 32]); assert_eq!(ctx.execution_nonce, 12345); - assert_eq!(ctx.opaque_inputs, &inputs); assert!(ctx.is_protocol_v1()); assert!(ctx.is_kernel_v1()); - assert_eq!(ctx.inputs_len(), 5); - assert!(!ctx.inputs_is_empty()); } #[test] - fn test_agent_context_empty_inputs() { - let agent_id = [0u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - let inputs: [u8; 0] = []; - + fn test_agent_context_copy() { let ctx = AgentContext::new( 1, 1, - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - 0, - &inputs, - ); - - assert!(ctx.inputs_is_empty()); - assert_eq!(ctx.inputs_len(), 0); - assert!(!ctx.has_snapshot_prefix()); - assert!(ctx.agent_inputs().is_empty()); - } - - #[test] - fn test_agent_context_with_snapshot_prefix() { - let agent_id = [0u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - // 36 bytes snapshot + 4 bytes agent data - let inputs = [0u8; 40]; - - let ctx = AgentContext::new( - 1, - 1, - &agent_id, - &code_hash, - &constraint_hash, - &input_root, - 0, - &inputs, - ); - - assert!(ctx.has_snapshot_prefix()); - assert_eq!(ctx.agent_inputs().len(), 4); - } - - #[test] - fn test_agent_context_clone() { - let agent_id = [0x42u8; 32]; - let code_hash = [0u8; 32]; - let constraint_hash = [0u8; 32]; - let input_root = [0u8; 32]; - let inputs = [1u8, 2, 3]; - - let ctx = AgentContext::new( - 1, - 1, - &agent_id, - &code_hash, - &constraint_hash, - &input_root, + [0x42u8; 32], + [0u8; 32], + [0u8; 32], + [0u8; 32], 42, - &inputs, ); - let ctx2 = ctx.clone(); + // AgentContext is Copy + let ctx2 = ctx; assert_eq!(ctx.agent_id, ctx2.agent_id); assert_eq!(ctx.execution_nonce, ctx2.execution_nonce); } + + #[test] + fn test_agent_context_repr_c() { + // Verify the struct has a predictable size + // 4 + 4 + 32 + 32 + 32 + 32 + 8 = 144 bytes + assert_eq!(core::mem::size_of::(), 144); + } } diff --git a/crates/kernel-sdk/src/lib.rs b/crates/kernel-sdk/src/lib.rs index 6e3599e..4d15d82 100644 --- a/crates/kernel-sdk/src/lib.rs +++ b/crates/kernel-sdk/src/lib.rs @@ -25,11 +25,13 @@ //! //! ```ignore //! #[no_mangle] -//! pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput +//! pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput //! ``` //! -//! The symbol name `agent_main` is fixed. No other entrypoints are recognized. -//! Panics abort execution and invalidate the proof. +//! - Uses `extern "Rust"` for safe ABI with Rust types +//! - The symbol name `agent_main` is fixed and mandatory +//! - No other entrypoints are recognized by the kernel +//! - Panics abort execution and invalidate the proof //! //! # Example Agent //! @@ -37,9 +39,9 @@ //! use kernel_sdk::prelude::*; //! //! #[no_mangle] -//! pub extern "C" fn agent_main(ctx: &AgentContext) -> AgentOutput { +//! pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { //! // Echo the opaque inputs back as an action -//! let action = echo_action(*ctx.agent_id, ctx.opaque_inputs.to_vec()); +//! let action = echo_action(ctx.agent_id, opaque_inputs.to_vec()); //! //! // Build output with explicit, bounded allocation //! let mut actions = Vec::with_capacity(1); @@ -258,9 +260,9 @@ mod tests { #[allow(unused_imports)] use crate::prelude::*; - // Verify key types are accessible + // Verify key types are accessible with 2-arg signature fn _check_types() { - let _: fn(&AgentContext) -> AgentOutput = |_| AgentOutput { + let _: fn(&AgentContext, &[u8]) -> AgentOutput = |_, _| AgentOutput { actions: Vec::new(), }; } From a60e45efbc0aca0285a6beea906cebb3c8a7bd9f Mon Sep 17 00:00:00 2001 From: mehdi-defiesta Date: Sat, 24 Jan 2026 14:39:25 +0100 Subject: [PATCH 2/3] refactor: Remove agent-traits crate The agent-traits crate was providing duplicate ABI definitions that conflicted with kernel-sdk's canonical definitions. Since nothing is deployed yet, removing the crate entirely simplifies the architecture. All canonical ABI types (AgentContext, AgentOutput, AgentEntrypoint) are now defined solely in kernel-sdk. The example-agent crate demonstrates the correct agent implementation pattern. Also fixed stale comment in host-tests that referenced "extern C" when it should say "extern Rust". --- Cargo.lock | 8 -- Cargo.toml | 1 - crates/agent-traits/Cargo.toml | 16 ---- crates/agent-traits/src/lib.rs | 162 --------------------------------- crates/host-tests/src/lib.rs | 4 +- 5 files changed, 2 insertions(+), 189 deletions(-) delete mode 100644 crates/agent-traits/Cargo.toml delete mode 100644 crates/agent-traits/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index ef72388..0ad04fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,14 +2,6 @@ # It is not intended for manual editing. version = 4 -[[package]] -name = "agent-traits" -version = "0.1.0" -dependencies = [ - "kernel-core", - "kernel-sdk", -] - [[package]] name = "block-buffer" version = "0.10.4" diff --git a/Cargo.toml b/Cargo.toml index 4398428..a0d6533 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,6 @@ resolver = "2" members = [ "crates/kernel-core", "crates/kernel-guest", - "crates/agent-traits", "crates/constraints", "crates/kernel-sdk", "crates/example-agent", diff --git a/crates/agent-traits/Cargo.toml b/crates/agent-traits/Cargo.toml deleted file mode 100644 index 1579a15..0000000 --- a/crates/agent-traits/Cargo.toml +++ /dev/null @@ -1,16 +0,0 @@ -[package] -name = "agent-traits" -version = "0.1.0" -edition = "2021" -description = "Agent ABI definitions and reference implementations" -license = "Apache-2.0" - -[dependencies] -kernel-core = { path = "../kernel-core" } -kernel-sdk = { path = "../kernel-sdk" } - -[features] -default = ["reference-agents"] -# Enable reference agent implementations (TrivialAgent, NoOpAgent, MultiActionAgent) -# These are useful for testing but should not be used in production -reference-agents = [] \ No newline at end of file diff --git a/crates/agent-traits/src/lib.rs b/crates/agent-traits/src/lib.rs deleted file mode 100644 index f00b957..0000000 --- a/crates/agent-traits/src/lib.rs +++ /dev/null @@ -1,162 +0,0 @@ -//! Agent ABI Definitions and Reference Implementations -//! -//! This crate provides the canonical agent interface types and reference -//! implementations for testing. -//! -//! # Canonical Types (from kernel-sdk) -//! -//! - [`AgentContext`] - Execution context provided to agents -//! - [`AgentEntrypoint`] - Type alias for the canonical agent_main signature -//! - [`AgentOutput`] - Structured output containing ordered actions -//! -//! # Entrypoint Symbol -//! -//! The canonical entrypoint symbol name is defined by [`AGENT_ENTRYPOINT_SYMBOL`]. -//! All agents must expose exactly this function: -//! -//! ```ignore -//! #[no_mangle] -//! pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput -//! ``` -//! -//! # Reference Agents (feature: `reference-agents`) -//! -//! When the `reference-agents` feature is enabled (default), the following -//! test implementations are available: -//! -//! - [`TrivialAgent`] - Echoes input as a single action -//! - [`NoOpAgent`] - Produces no actions -//! - [`MultiActionAgent`] - Produces multiple actions for testing -//! -//! These are NOT production-ready and exist only for testing. - -// Re-export canonical types from kernel-sdk -pub use kernel_sdk::agent::{AgentContext, AgentEntrypoint}; -pub use kernel_sdk::types::AgentOutput; - -/// Canonical entrypoint symbol name. -/// -/// All agents must export a function with this exact symbol name. -/// The kernel uses this symbol to locate the agent entrypoint. -pub const AGENT_ENTRYPOINT_SYMBOL: &str = "agent_main"; - -// ============================================================================ -// Legacy Types (for backward compatibility during transition) -// ============================================================================ - -use kernel_core::{ActionV1, AgentError, MAX_ACTIONS_PER_OUTPUT}; - -/// Legacy agent context (owned fields). -/// -/// **DEPRECATED**: Use [`AgentContext`] from kernel-sdk instead. -/// This type is kept for backward compatibility during the transition -/// to the canonical `agent_main` entrypoint. -#[deprecated( - since = "0.2.0", - note = "Use kernel_sdk::agent::AgentContext instead" -)] -#[derive(Clone, Debug)] -pub struct LegacyAgentContext { - /// 32-byte agent identifier - pub agent_id: [u8; 32], - /// SHA-256 hash of the agent's own code - pub agent_code_hash: [u8; 32], - /// SHA-256 hash of the constraint set being enforced - pub constraint_set_hash: [u8; 32], - /// External state root (market/vault snapshot) - pub input_root: [u8; 32], - /// Execution nonce for replay protection - pub execution_nonce: u64, -} - -/// Legacy agent trait interface. -/// -/// **DEPRECATED**: Implement `agent_main` function directly instead. -/// This trait is kept for backward compatibility during the transition. -#[deprecated( - since = "0.2.0", - note = "Implement extern \"Rust\" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput instead" -)] -pub trait Agent { - /// Execute the agent with the given context and inputs. - fn run(ctx: &LegacyAgentContext, inputs: &[u8]) -> Result; -} - -// ============================================================================ -// Reference Agent Implementations (behind feature flag) -// ============================================================================ - -#[cfg(feature = "reference-agents")] -mod reference_agents { - use super::*; - - /// Action type for echo action (used by TrivialAgent) - pub const ACTION_TYPE_ECHO: u32 = 0x00000001; - - /// Trivial reference agent implementation. - /// - /// WARNING: This is NOT production-ready and exists only for testing. - /// It converts input bytes into a single "echo" action. - pub struct TrivialAgent; - - #[allow(deprecated)] - impl Agent for TrivialAgent { - /// Converts input into a single echo action. - /// - /// The action targets the agent's own ID and carries - /// the input as payload (truncated to max payload size). - fn run(ctx: &LegacyAgentContext, inputs: &[u8]) -> Result { - // Truncate to max payload size if needed - let payload_len = inputs.len().min(kernel_core::MAX_ACTION_PAYLOAD_BYTES); - let payload = inputs[..payload_len].to_vec(); - - let action = ActionV1 { - action_type: ACTION_TYPE_ECHO, - target: ctx.agent_id, - payload, - }; - - Ok(kernel_core::AgentOutput { - actions: vec![action], - }) - } - } - - /// No-op agent that produces no actions. - /// - /// Useful for testing constraint enforcement with empty output. - pub struct NoOpAgent; - - #[allow(deprecated)] - impl Agent for NoOpAgent { - fn run(_ctx: &LegacyAgentContext, _inputs: &[u8]) -> Result { - Ok(kernel_core::AgentOutput { actions: vec![] }) - } - } - - /// Agent that produces multiple actions for testing. - pub struct MultiActionAgent; - - #[allow(deprecated)] - impl Agent for MultiActionAgent { - /// Produces one action per byte of input (up to MAX_ACTIONS_PER_OUTPUT). - fn run(ctx: &LegacyAgentContext, inputs: &[u8]) -> Result { - let action_count = inputs.len().min(MAX_ACTIONS_PER_OUTPUT); - - let actions: Vec = inputs[..action_count] - .iter() - .enumerate() - .map(|(i, &byte)| ActionV1 { - action_type: i as u32, - target: ctx.agent_id, - payload: vec![byte], - }) - .collect(); - - Ok(kernel_core::AgentOutput { actions }) - } - } -} - -#[cfg(feature = "reference-agents")] -pub use reference_agents::*; diff --git a/crates/host-tests/src/lib.rs b/crates/host-tests/src/lib.rs index ce67516..57103d5 100644 --- a/crates/host-tests/src/lib.rs +++ b/crates/host-tests/src/lib.rs @@ -1,5 +1,5 @@ -// Force linking of example-agent to provide the agent_main symbol -// This is required because kernel-guest declares an extern "C" fn agent_main +// Force linking of example-agent to provide the agent_main symbol. +// This is required because kernel-guest declares an extern "Rust" fn agent_main // which must be provided by a linked agent crate. extern crate example_agent; From 6cf77ab806e017722038385d1f4a599b4b9b111e Mon Sep 17 00:00:00 2001 From: mehdi-defiesta Date: Sat, 24 Jan 2026 23:20:10 +0100 Subject: [PATCH 3/3] feat: Add E2E zkVM proof tests with RISC Zero integration - Add methods crate for building zkVM guest ELF and exporting IMAGE_ID - Add zkvm-guest wrapper crate for risc0-build compatibility - Add e2e-tests crate with feature-gated proof generation tests - Add agent code hash binding (build.rs generates AGENT_CODE_HASH) - Add spec/e2e-tests.md specification document - Update README with E2E testing and on-chain verification sections Test cases: - test_e2e_success_with_echo: Happy path with proof generation - test_e2e_agent_code_hash_mismatch: Security validation - test_e2e_empty_output: Empty output commitment verification - test_e2e_determinism: Deterministic execution verification On-chain data extraction: - seal (256 bytes Groth16 proof) - journal (KernelJournalV1 bytes) - imageId (bytes32 guest identity) --- .gitignore | 3 +- Cargo.lock | 4511 ++++++++++++++++++++++++- Cargo.toml | 2 + README.md | 82 +- crates/e2e-tests/Cargo.toml | 40 + crates/e2e-tests/README.md | 177 + crates/e2e-tests/src/lib.rs | 398 +++ crates/example-agent/Cargo.toml | 3 + crates/example-agent/build.rs | 130 + crates/example-agent/src/lib.rs | 45 +- crates/host-tests/src/lib.rs | 154 +- crates/kernel-guest/Cargo.toml | 5 +- crates/kernel-guest/src/lib.rs | 102 +- crates/kernel-guest/src/main.rs | 29 +- crates/methods/Cargo.toml | 14 + crates/methods/build.rs | 66 + crates/methods/src/lib.rs | 45 + crates/methods/zkvm-guest/Cargo.lock | 1506 +++++++++ crates/methods/zkvm-guest/Cargo.toml | 27 + crates/methods/zkvm-guest/src/main.rs | 33 + spec/e2e-tests.md | 414 +++ 21 files changed, 7590 insertions(+), 196 deletions(-) create mode 100644 crates/e2e-tests/Cargo.toml create mode 100644 crates/e2e-tests/README.md create mode 100644 crates/e2e-tests/src/lib.rs create mode 100644 crates/example-agent/build.rs create mode 100644 crates/methods/Cargo.toml create mode 100644 crates/methods/build.rs create mode 100644 crates/methods/src/lib.rs create mode 100644 crates/methods/zkvm-guest/Cargo.lock create mode 100644 crates/methods/zkvm-guest/Cargo.toml create mode 100644 crates/methods/zkvm-guest/src/main.rs create mode 100644 spec/e2e-tests.md diff --git a/.gitignore b/.gitignore index 2c5f308..a98c68e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ CLAUDE.md target/ -*/target/ \ No newline at end of file +*/target/ +/.claude \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 0ad04fd..7ee8823 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,232 +2,4527 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "cpp_demangle", + "fallible-iterator", + "gimli 0.31.1", + "memmap2", + "object 0.36.7", + "rustc-demangle", + "smallvec", + "typed-arena", +] + +[[package]] +name = "addr2line" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5d307320b3181d6d7954e663bd7c774a838b8220fe0593c86d9fb09f498b4b" +dependencies = [ + "gimli 0.32.3", +] + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" +dependencies = [ + "backtrace", +] + +[[package]] +name = "arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d036a3c4ab069c7b410a2ce876bd74808d2d0888a82667669f8e783a898bf1" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-r1cs-std", + "ark-std", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" +dependencies = [ + "ahash", + "ark-crypto-primitives-macros", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-snark", + "ark-std", + "blake2", + "derivative", + "digest", + "fnv", + "merlin", + "sha2", +] + +[[package]] +name = "ark-crypto-primitives-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "educe", + "fnv", + "hashbrown 0.15.5", + "itertools 0.13.0", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "arrayvec", + "digest", + "educe", + "itertools 0.13.0", + "num-bigint 0.4.6", + "num-traits", + "paste", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint 0.4.6", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-groth16" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff", + "ark-serialize", + "ark-std", + "educe", + "fnv", + "hashbrown 0.15.5", +] + +[[package]] +name = "ark-r1cs-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-relations", + "ark-std", + "educe", + "num-bigint 0.4.6", + "num-integer", + "num-traits", + "tracing", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff", + "ark-std", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "arrayvec", + "digest", + "num-bigint 0.4.6", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-snark" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" +dependencies = [ + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "arraydeque" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d902e3d592a523def97af8f317b08ce16b7ab854c1985a0c671e6f15cebc236" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "atomic-polyfill" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2bce30dfe09ef0bfaef228b9d414faaf7e563035494d7fe092dba54b300f4" +dependencies = [ + "critical-section", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb531853791a215d7c62a30daf0dde835f381ab5de4589cfe7c649d2cbe92bd6" +dependencies = [ + "addr2line 0.25.1", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.37.3", + "rustc-demangle", + "windows-link", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "bumpalo" +version = "3.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510" + +[[package]] +name = "bytemuck" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b35204fbdc0b3f4446b89fc1ac2cf84a8a68971995d0bf2e925ec7cd960f9cb3" +dependencies = [ + "serde", +] + +[[package]] +name = "camino" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629a66d692cb9ff1a1c664e41771b3dcaf961985a9774c0eb0bd1b51cf60a48" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.18", +] + +[[package]] +name = "cc" +version = "1.2.54" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6354c81bbfd62d9cfa9cb3c773c2b7b2a3a482d569de977fd0e961f6e7c00583" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror 2.0.18", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constraints" +version = "0.1.0" +dependencies = [ + "kernel-core", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpp_demangle" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2bb79cb74d735044c972aae58ed0aaa9a837e85b01106a54c39e42e97f62253" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9481c1c90cbf2ac953f07c8d4a58aa3945c425b7185c9154d67a65e4230da511" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "critical-section" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core 0.21.3", + "darling_macro 0.21.3", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.114", +] + +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.114", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core 0.21.3", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" +dependencies = [ + "powerfmt", + "serde_core", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn 2.0.114", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.114", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "directories" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3e8aa94d75141228480295a7d0e7feb620b1a5ad9f12bc40be62411e38cce4e" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "docker-generate" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf673e0848ef09fa4aeeba78e681cf651c0c7d35f76ee38cec8e55bc32fa111" + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "downloader" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac1e888d6830712d565b2f3a974be3200be9296bc1b03db8251a4cbf18a4a34" +dependencies = [ + "digest", + "futures", + "rand 0.8.5", + "reqwest", + "thiserror 1.0.69", + "tokio", +] + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "e2e-tests" +version = "0.1.0" +dependencies = [ + "constraints", + "example-agent", + "hex", + "kernel-core", + "kernel-sdk", + "methods", + "risc0-zkvm", +] + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enum-map" +version = "2.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" +dependencies = [ + "enum-map-derive", +] + +[[package]] +name = "enum-map-derive" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "erased-serde" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89e8918065695684b2b0702da20382d5ae6065cf3327bc2d6436bd49a71ce9f3" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "example-agent" +version = "0.1.0" +dependencies = [ + "kernel-sdk", + "sha2", +] + +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "bitvec", + "byteorder", + "ff_derive", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "ff_derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f10d12652036b0e99197587c6ba87a8fc3031986499973c030d8b44fcc151b60" +dependencies = [ + "addchain", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" + +[[package]] +name = "flate2" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b375d6465b98090a5f25b1c7703f3859783755aa9a80433b36e0379a3ec2f369" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "gdbstub" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72742d2b395902caf8a5d520d0dd3334ba6d1138938429200e58d5174e275f3f" +dependencies = [ + "bitflags 2.10.0", + "cfg-if", + "log", + "managed", + "num-traits", + "paste", +] + +[[package]] +name = "gdbstub_arch" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22dde0e1b68787036ccedd0b1ff6f953527a0e807e571fbe898975203027278f" +dependencies = [ + "gdbstub", + "num-traits", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +dependencies = [ + "fallible-iterator", + "indexmap 2.13.0", + "stable_deref_trait", +] + +[[package]] +name = "gimli" +version = "0.32.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e629b9b98ef3dd8afe6ca2bd0f89306cec16d43d907889945bc5d6687f2f13c7" + +[[package]] +name = "glob" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280" + +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hashlink" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" +dependencies = [ + "hashbrown 0.15.5", +] + +[[package]] +name = "heapless" +version = "0.7.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "serde", + "spin", + "stable_deref_trait", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "host-tests" +version = "0.1.0" +dependencies = [ + "constraints", + "example-agent", + "kernel-core", + "kernel-guest", + "kernel-sdk", + "serde", + "serde_json", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "727805d60e7938b76b826a6ef209eb70eaa1812794f9424d4a4e2d740662df5f" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "include_bytes_aligned" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee796ad498c8d9a1d68e477df8f754ed784ef875de1414ebdaf169f70a6a784" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", + "serde", + "serde_core", +] + +[[package]] +name = "inventory" +version = "0.3.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc61209c082fbeb19919bee74b176221b27223e27b65d781eb91af24eb1fb46e" +dependencies = [ + "rustversion", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "jobserver" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afb3de4395d6b3e67a780b6de64b51c978ecf11cb9a462c66be7d4ca9039d33" +dependencies = [ + "getrandom 0.3.4", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kernel-core" +version = "0.1.0" +dependencies = [ + "sha2", +] + +[[package]] +name = "kernel-guest" +version = "0.1.0" +dependencies = [ + "constraints", + "example-agent", + "kernel-core", + "kernel-sdk", + "risc0-zkvm", +] + +[[package]] +name = "kernel-sdk" +version = "0.1.0" +dependencies = [ + "kernel-core", +] + +[[package]] +name = "lazy-regex" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5c13b6857ade4c8ee05c3c3dc97d2ab5415d691213825b90d3211c425c1f907" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a95c68db5d41694cea563c86a4ba4dc02141c16ef64814108cb23def4d5438" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.114", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "liblzma" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c36d08cad03a3fbe2c4e7bb3a9e84c57e4ee4135ed0b065cade3d98480c648" +dependencies = [ + "liblzma-sys", +] + +[[package]] +name = "liblzma-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f2db66f3268487b5033077f266da6777d057949b8f93c8ad82e441df25e6186" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616" +dependencies = [ + "bitflags 2.10.0", + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "malachite" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fbdf9cb251732db30a7200ebb6ae5d22fe8e11397364416617d2c2cf0c51cb5" +dependencies = [ + "malachite-base", + "malachite-float", + "malachite-nz", + "malachite-q", +] + +[[package]] +name = "malachite-base" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ea0ed76adf7defc1a92240b5c36d5368cfe9251640dcce5bd2d0b7c1fd87aeb" +dependencies = [ + "hashbrown 0.14.5", + "itertools 0.11.0", + "libm", + "ryu", +] + +[[package]] +name = "malachite-float" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af9d20db1c73759c1377db7b27575df6f2eab7368809dd62c0a715dc1bcc39f7" +dependencies = [ + "itertools 0.11.0", + "malachite-base", + "malachite-nz", + "malachite-q", +] + +[[package]] +name = "malachite-nz" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34a79feebb2bc9aa7762047c8e5495269a367da6b5a90a99882a0aeeac1841f7" +dependencies = [ + "itertools 0.11.0", + "libm", + "malachite-base", +] + +[[package]] +name = "malachite-q" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50f235d5747b1256b47620f5640c2a17a88c7569eebdf27cd9cb130e1a619191" +dependencies = [ + "itertools 0.11.0", + "malachite-base", + "malachite-nz", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "managed" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ca88d725a0a943b096803bd34e73a4437208b6077654cc4ecb2947a5f91618d" + +[[package]] +name = "matrixmultiply" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a06de3016e9fae57a36fd14dba131fccf49f74b40b7fbdb472f96e361ec71a08" +dependencies = [ + "autocfg", + "rawpointer", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "memmap2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "744133e4a0e0a658e1374cf3bf8e415c4052a15a111acd372764c55b4177d490" +dependencies = [ + "libc", +] + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "metal" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +dependencies = [ + "bitflags 2.10.0", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "methods" +version = "0.1.0" +dependencies = [ + "risc0-build", +] + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "ndarray" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882ed72dce9365842bf196bdeedf5055305f11fc8c03dee7bb0194a6cad34841" +dependencies = [ + "matrixmultiply", + "num-complex", + "num-integer", + "num-traits", + "portable-atomic", + "portable-atomic-util", + "rawpointer", + "rayon", +] + +[[package]] +name = "no_std_strings" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b0c77c1b780822bc749a33e39aeb2c07584ab93332303babeabb645298a76e" + +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-bigint-dig" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e661dda6640fad38e827a6d4a310ff4763082116fe217f279885c97f511bb0b7" +dependencies = [ + "lazy_static", + "libm", + "num-integer", + "num-iter", + "num-traits", + "rand 0.8.5", + "smallvec", + "zeroize", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + +[[package]] +name = "num-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "nvtx" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad2e855e8019f99e4b94ac33670eb4e4f570a2e044f3749a0b2c7f83b841e52c" +dependencies = [ + "cc", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "flate2", + "memchr", + "ruzstd", +] + +[[package]] +name = "object" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff76201f031d8863c38aa7f905eca4f53abbfa15f609db4277d44cd8938f33fe" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs1" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f" +dependencies = [ + "der", + "pkcs8", + "spki", +] + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "portable-atomic" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89776e4d69bb58bc6993e99ffa1d11f228b839984854c7daeb5d37f87cbe950" + +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "heapless", + "serde", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +dependencies = [ + "toml_edit 0.23.10+spec-1.0.0", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags 2.10.0", + "num-traits", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_xorshift", + "unarray", +] + +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" +dependencies = [ + "anyhow", + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "puffin" +version = "0.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa9dae7b05c02ec1a6bc9bcf20d8bc64a7dcbf57934107902a872014899b741f" +dependencies = [ + "anyhow", + "byteorder", + "cfg-if", + "itertools 0.10.5", + "once_cell", + "parking_lot", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror 2.0.18", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror 2.0.18", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rawpointer" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" + +[[package]] +name = "rayon" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.10.0", +] + +[[package]] +name = "redox_users" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" +dependencies = [ + "getrandom 0.2.17", + "libredox", + "thiserror 2.0.18", +] + +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "regex" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "ringbuffer" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df6368f71f205ff9c33c076d170dd56ebf68e8161c733c0caa07a7a5509ed53" + +[[package]] +name = "risc0-binfmt" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dca096030bb4c52f99b12abcfe3531ea93b17b95a12a5aeb06fbf8ee588a275" +dependencies = [ + "anyhow", + "borsh", + "bytemuck", + "derive_more", + "elf", + "lazy_static", + "postcard", + "rand 0.9.2", + "risc0-zkp", + "risc0-zkvm-platform", + "ruint", + "semver", + "serde", + "tracing", +] + +[[package]] +name = "risc0-build" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e744682b661f2a022fddffddfe242608f8b194e839d9e83ddbb3378974942241" +dependencies = [ + "anyhow", + "cargo_metadata", + "derive_builder", + "dirs", + "docker-generate", + "hex", + "risc0-binfmt", + "risc0-zkos-v1compat", + "risc0-zkp", + "risc0-zkvm-platform", + "rzup", + "semver", + "serde", + "serde_json", + "stability", + "tempfile", +] + +[[package]] +name = "risc0-build-kernel" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaaa3e04c71e4244354dd9e3f8b89378cfecfbb03f9c72de4e2e7e0482b30c9a" +dependencies = [ + "cc", + "directories", + "hex", + "rayon", + "sha2", + "tempfile", +] + +[[package]] +name = "risc0-circuit-keccak" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e1d23ef3648bb85b0bd37bc9f9f7d13f1a4388e5e779e18f7eea82b969e5dbc" +dependencies = [ + "anyhow", + "bytemuck", + "cfg-if", + "keccak", + "liblzma", + "paste", + "rayon", + "risc0-binfmt", + "risc0-circuit-keccak-sys", + "risc0-circuit-recursion", + "risc0-core", + "risc0-sys", + "risc0-zkp", + "tracing", +] + +[[package]] +name = "risc0-circuit-keccak-sys" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a8f21cc053fe9892acebbe0ebe2610a5d79ad638cd17f2e5122cf0b3e7cd1a" +dependencies = [ + "cc", + "derive_more", + "glob", + "risc0-build-kernel", + "risc0-core", + "risc0-sys", +] + +[[package]] +name = "risc0-circuit-recursion" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028cd26e1b1f7bdd964d2f1eac8f812d1872b6b8fd24f10804f07d916b90000e" +dependencies = [ + "anyhow", + "bytemuck", + "cfg-if", + "downloader", + "hex", + "lazy-regex", + "metal", + "rand 0.9.2", + "rayon", + "risc0-circuit-recursion-sys", + "risc0-core", + "risc0-sys", + "risc0-zkp", + "serde", + "sha2", + "tracing", + "zip", +] + +[[package]] +name = "risc0-circuit-recursion-sys" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f137bcd382520efcd982e4ee131da43f448b12ade979fe9d1fa92d4337dec0" +dependencies = [ + "glob", + "risc0-build-kernel", + "risc0-core", + "risc0-sys", +] + +[[package]] +name = "risc0-circuit-rv32im" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ecd73a71ddce62eab8a28552ee182dc2ea08cdce2a3474a616a80bf2d6e9be" +dependencies = [ + "anyhow", + "bit-vec", + "bytemuck", + "byteorder", + "cfg-if", + "derive_more", + "enum-map", + "gdbstub", + "gdbstub_arch", + "malachite", + "num-derive", + "num-traits", + "paste", + "postcard", + "rand 0.9.2", + "rayon", + "ringbuffer", + "risc0-binfmt", + "risc0-circuit-rv32im-sys", + "risc0-core", + "risc0-sys", + "risc0-zkp", + "serde", + "smallvec", + "tracing", + "wide", +] + +[[package]] +name = "risc0-circuit-rv32im-sys" +version = "4.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb25f3935e53e89ca020224ad0c09de96cab89a215054c0cee290405074a5166" +dependencies = [ + "cc", + "derive_more", + "glob", + "risc0-build-kernel", + "risc0-core", + "risc0-sys", +] + +[[package]] +name = "risc0-core" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80f2723fedace48c6c5a505bd8f97ac4e1712bc4cb769083e10536d862b66987" +dependencies = [ + "bytemuck", + "nvtx", + "puffin", + "rand_core 0.9.5", +] + +[[package]] +name = "risc0-groth16" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ff13f9b427254c5264e01aaa32e33f355525299b6829449295905778f3b1e8" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-groth16", + "ark-serialize", + "bytemuck", + "cfg-if", + "hex", + "num-bigint 0.4.6", + "num-traits", + "risc0-binfmt", + "risc0-core", + "risc0-zkp", + "rzup", + "serde", + "serde_json", + "tempfile", + "tracing", +] + +[[package]] +name = "risc0-sys" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960c8295fbb87e1e73e332f8f7de2fba0252377575042d9d3e9a4eb50a38e078" +dependencies = [ + "anyhow", + "risc0-build-kernel", +] + +[[package]] +name = "risc0-zkos-v1compat" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf1f35f2ef61d8d86fdd06288c11d2f3bbf08f1af66b24ca0a1976ecbf324a1" +dependencies = [ + "include_bytes_aligned", + "no_std_strings", + "risc0-zkvm-platform", +] + +[[package]] +name = "risc0-zkp" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb493b3f007f04a11106a001c66bca77338d0fc375766189fd7ca3a1e8c3700" +dependencies = [ + "anyhow", + "blake2", + "borsh", + "bytemuck", + "cfg-if", + "digest", + "ff", + "hex", + "hex-literal", + "metal", + "ndarray", + "parking_lot", + "paste", + "rand 0.9.2", + "rand_core 0.9.5", + "rayon", + "risc0-core", + "risc0-sys", + "risc0-zkvm-platform", + "serde", + "sha2", + "stability", + "tracing", +] + +[[package]] +name = "risc0-zkvm" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39d9943fe71decea1e8b6a99480cefa33799ab08b5abfccd7e2a18fb07121c1" +dependencies = [ + "addr2line 0.24.2", + "anyhow", + "bincode", + "borsh", + "bytemuck", + "bytes", + "derive_more", + "elf", + "enum-map", + "gdbstub", + "gdbstub_arch", + "gimli 0.31.1", + "hex", + "keccak", + "lazy-regex", + "num-bigint 0.4.6", + "num-traits", + "object 0.36.7", + "prost", + "rand 0.9.2", + "rayon", + "risc0-binfmt", + "risc0-build", + "risc0-circuit-keccak", + "risc0-circuit-recursion", + "risc0-circuit-rv32im", + "risc0-core", + "risc0-groth16", + "risc0-zkos-v1compat", + "risc0-zkp", + "risc0-zkvm-platform", + "rrs-lib", + "rustc-demangle", + "rzup", + "semver", + "serde", + "sha2", + "stability", + "tempfile", + "tracing", + "typetag", +] + +[[package]] +name = "risc0-zkvm-platform" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfaa10feba15828c788837ddde84b994393936d8f5715228627cfe8625122a40" +dependencies = [ + "bytemuck", + "cfg-if", + "getrandom 0.2.17", + "getrandom 0.3.4", + "libm", + "num_enum", + "paste", + "stability", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] + +[[package]] +name = "rsa" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8573f03f5883dcaebdfcf4725caa1ecb9c15b2ef50c43a07b816e06799bb12d" +dependencies = [ + "const-oid", + "digest", + "num-bigint-dig", + "num-integer", + "num-traits", + "pkcs1", + "pkcs8", + "rand_core 0.6.4", + "signature", + "spki", + "subtle", + "zeroize", +] + +[[package]] +name = "ruint" +version = "1.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" +dependencies = [ + "borsh", + "proptest", + "rand 0.8.5", + "rand 0.9.2", + "ruint-macro", + "serde_core", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags 2.10.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c665f33d38cea657d9614f766881e4d510e0eda4239891eea56b4cadcf01801b" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ruzstd" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fad02996bfc73da3e301efe90b1837be9ed8f4a462b6ed410aa35d00381de89f" +dependencies = [ + "twox-hash", +] + +[[package]] +name = "ryu" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984" + +[[package]] +name = "rzup" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d2aed296f203fa64bcb4b52069356dd86d6ec578593985b919b6995bee1f0ae" +dependencies = [ + "hex", + "rsa", + "semver", + "serde", + "serde_with", + "sha2", + "strum", + "tempfile", + "thiserror 2.0.18", + "toml", + "yaml-rust2", +] + +[[package]] +name = "safe_arch" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b02de82ddbe1b636e6170c21be622223aea188ef2e139be0a5b219ec215323" +dependencies = [ + "bytemuck", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e910108742c57a770f492731f99be216a52fadd361b06c8fb59d74ccc267d2" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fa237f2807440d238e0364a218270b98f767a00d3dada77b1c53ae88940e2e7" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.13.0", + "schemars 0.9.0", + "schemars 1.2.0", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52a8e3ca0ca629121f70ab50f95249e5a6f925cc0f6ffe8256c45b728875706c" +dependencies = [ + "darling 0.21.3", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core 0.6.4", +] + +[[package]] +name = "simd-adler32" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e320a6c5ad31d271ad523dcf3ad13e2767ad8b1cb8f047f75a8aeaf8da139da2" + +[[package]] +name = "slab" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a2ae44ef20feb57a68b23d846850f861394c2e02dc425a50098ae8c90267589" + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "time" +version = "0.3.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9da98b7d9b7dad93488a84b8248efc35352b0b2657397d4167e7ad67e5d535e5" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78cc610bac2dcee56805c99642447d4c5dbde4d01f752ffea0199aee1f601dc4" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_edit 0.22.27", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.13.0", + "serde", + "serde_spanned", + "toml_datetime 0.6.11", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_edit" +version = "0.23.10+spec-1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +dependencies = [ + "indexmap 2.13.0", + "toml_datetime 0.7.5+spec-1.1.0", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags 2.10.0", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + +[[package]] +name = "typed-arena" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6af6ae20167a9ece4bcb41af5b80f8a1f1df981f6391189ce00fd257af04126a" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "typetag" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be2212c8a9b9bcfca32024de14998494cf9a5dfa59ea1b829de98bac374b86bf" +dependencies = [ + "erased-serde", + "inventory", + "once_cell", + "serde", + "typetag-impl", +] + +[[package]] +name = "typetag-impl" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27a7a9b72ba121f6f1f6c3632b85604cac41aedb5ddc70accbebb6cac83de846" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" dependencies = [ - "generic-array", + "wit-bindgen", ] [[package]] -name = "cfg-if" -version = "1.0.4" +name = "wasm-bindgen" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] [[package]] -name = "constraints" -version = "0.1.0" +name = "wasm-bindgen-futures" +version = "0.4.58" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a6e77fd0ae8029c9ea0063f87c46fde723e7d887703d74ad2616d792e51e6f" dependencies = [ - "kernel-core", + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", ] [[package]] -name = "cpufeatures" -version = "0.2.17" +name = "wasm-bindgen-macro" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" dependencies = [ - "libc", + "quote", + "wasm-bindgen-macro-support", ] [[package]] -name = "crypto-common" -version = "0.1.7" +name = "wasm-bindgen-macro-support" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" dependencies = [ - "generic-array", - "typenum", + "bumpalo", + "proc-macro2", + "quote", + "syn 2.0.114", + "wasm-bindgen-shared", ] [[package]] -name = "digest" -version = "0.10.7" +name = "wasm-bindgen-shared" +version = "0.2.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" dependencies = [ - "block-buffer", - "crypto-common", + "unicode-ident", ] [[package]] -name = "example-agent" -version = "0.1.0" +name = "web-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "312e32e551d92129218ea9a2452120f4aabc03529ef03e4d0d82fb2780608598" dependencies = [ - "kernel-sdk", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "generic-array" -version = "0.14.7" +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ - "typenum", - "version_check", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "host-tests" -version = "0.1.0" +name = "webpki-roots" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12bed680863276c63889429bfd6cab3b99943659923822de1c8a39c49e4d722c" dependencies = [ - "constraints", - "example-agent", - "kernel-core", - "kernel-guest", - "kernel-sdk", - "serde", - "serde_json", + "rustls-pki-types", ] [[package]] -name = "itoa" -version = "1.0.17" +name = "wide" +version = "0.7.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "0ce5da8ecb62bcd8ec8b7ea19f69a51275e91299be594ea5cc6ef7819e16cd03" +dependencies = [ + "bytemuck", + "safe_arch", +] [[package]] -name = "kernel-core" -version = "0.1.0" +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" dependencies = [ - "sha2", + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", ] [[package]] -name = "kernel-guest" -version = "0.1.0" +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" dependencies = [ - "constraints", - "example-agent", - "kernel-core", - "kernel-sdk", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] -name = "kernel-sdk" -version = "0.1.0" +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" dependencies = [ - "kernel-core", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] -name = "libc" -version = "0.2.180" +name = "windows-link" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" [[package]] -name = "memchr" -version = "2.7.6" +name = "windows-result" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] [[package]] -name = "proc-macro2" -version = "1.0.106" +name = "windows-strings" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" dependencies = [ - "unicode-ident", + "windows-link", ] [[package]] -name = "quote" -version = "1.0.43" +name = "windows-sys" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc74d9a594b72ae6656596548f56f667211f8a97b3d4c3d467150794690dc40a" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "proc-macro2", + "windows-targets 0.52.6", ] [[package]] -name = "serde" -version = "1.0.228" +name = "windows-sys" +version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "serde_core", - "serde_derive", + "windows-targets 0.53.5", ] [[package]] -name = "serde_core" -version = "1.0.228" +name = "windows-sys" +version = "0.61.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" dependencies = [ - "serde_derive", + "windows-link", ] [[package]] -name = "serde_derive" -version = "1.0.228" +name = "windows-targets" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yaml-rust2" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2462ea039c445496d8793d052e13787f2b90e750b833afee748e601c17621ed9" +dependencies = [ + "arraydeque", + "encoding_rs", + "hashlink", +] + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.114", + "synstructure", ] [[package]] -name = "serde_json" -version = "1.0.149" +name = "zerocopy" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" dependencies = [ - "itoa", - "memchr", - "serde", - "serde_core", - "zmij", + "zerocopy-derive", ] [[package]] -name = "sha2" -version = "0.10.9" +name = "zerocopy-derive" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" dependencies = [ - "cfg-if", - "cpufeatures", - "digest", + "proc-macro2", + "quote", + "syn 2.0.114", ] [[package]] -name = "syn" -version = "2.0.114" +name = "zerofrom" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "unicode-ident", + "syn 2.0.114", + "synstructure", ] [[package]] -name = "typenum" -version = "1.19.0" +name = "zeroize" +version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] [[package]] -name = "unicode-ident" -version = "1.0.22" +name = "zeroize_derive" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] [[package]] -name = "version_check" -version = "0.9.5" +name = "zerotrie" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zip" +version = "2.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabe6324e908f85a1c52063ce7aa26b68dcb7eb6dbc83a2d148403c9bc3eba50" +dependencies = [ + "arbitrary", + "crc32fast", + "crossbeam-utils", + "displaydoc", + "flate2", + "indexmap 2.13.0", + "memchr", + "thiserror 2.0.18", + "zopfli", +] [[package]] name = "zmij" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfcd145825aace48cff44a8844de64bf75feec3080e0aa5cdbde72961ae51a65" + +[[package]] +name = "zopfli" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f05cd8797d63865425ff89b5c4a48804f35ba0ce8d125800027ad6017d2b5249" +dependencies = [ + "bumpalo", + "crc32fast", + "log", + "simd-adler32", +] diff --git a/Cargo.toml b/Cargo.toml index a0d6533..2471933 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,8 @@ members = [ "crates/kernel-sdk", "crates/example-agent", "crates/host-tests", + "crates/methods", + "crates/e2e-tests", ] [workspace.dependencies] diff --git a/README.md b/README.md index 984c649..5a80498 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,6 @@ # Execution Kernel - Canonical zkVM Guest Program [![Build Status](https://img.shields.io/badge/build-passing-brightgreen)](#testing) -[![Tests](https://img.shields.io/badge/tests-82%20passed-brightgreen)](#testing) [![Deterministic](https://img.shields.io/badge/execution-deterministic-blue)](#consensus-critical-properties) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE) @@ -15,11 +14,16 @@ This repository implements the **Canonical zkVM Guest Program**. The kernel prov The project is organized as a Rust workspace with the following crates: -- **`kernel-core`** - Core types, deterministic binary codec, and SHA-256 hashing -- **`kernel-guest`** - RISC Zero guest binary implementation -- **`agent-traits`** - Canonical agent interface (with trivial reference implementation) -- **`constraints`** - Constraint engine with action validation, asset whitelists, position limits, and global invariants -- **`host-tests`** - Test suite (82 tests) +| Crate | Description | +|-------|-------------| +| `kernel-core` | Core types, deterministic binary codec, and SHA-256 hashing | +| `kernel-guest` | RISC Zero guest binary implementation | +| `kernel-sdk` | Canonical agent interface and SDK | +| `constraints` | Constraint engine with action validation, asset whitelists, position limits | +| `example-agent` | Reference agent implementation with `agent_main` entrypoint | +| `methods` | RISC Zero build crate - exports `ZKVM_GUEST_ELF` and `ZKVM_GUEST_ID` | +| `e2e-tests` | End-to-end zkVM proof tests | +| `host-tests` | Unit test suite (92 tests) | ## Protocol Constants @@ -41,10 +45,10 @@ cargo build --release --features risc0 ## Testing -Run the test suite: +### Unit Tests ```bash -# Run all tests +# Run all unit tests cargo test # Run tests with verbose output @@ -56,57 +60,52 @@ cargo test test_golden_vector cargo test test_constraint ``` -### Test Coverage +### E2E zkVM Proof Tests -The test suite includes **82 comprehensive tests**: - -- **Encoding round-trip tests** - Verify canonical codec correctness for all protocol types -- **Golden vector tests** - SHA-256 commitment verification with known outputs -- **Determinism tests** - Same input produces identical journal bytes -- **Trailing bytes rejection tests** - Strict decoding for all types -- **Constraint validation tests** - All violation codes, payload schemas, whitelist checks -- **Overflow protection tests** - Cooldown timestamp arithmetic safety -- **Protocol validation tests** - Version checks and identity field propagation - -### Deterministic Binary Codec - -All protocol objects use explicit manual encoding: - -- Little-endian integers (`u32::to_le_bytes()`) -- Length-prefixed byte arrays (`[length: u32][data: bytes]`) -- Fixed-size arrays (agent_id, commitments) -- No serde auto-derive to ensure determinism -- Strict trailing bytes rejection +End-to-end tests that generate actual RISC Zero proofs: +```bash +# Install RISC Zero toolchain first +cargo install cargo-risczero +cargo risczero install -### Failure Semantics +# Run E2E proof tests (requires RISC Zero) +cargo test -p e2e-tests --features risc0-e2e -- --test-threads=1 --nocapture +``` -- **Hard failures** (decoding, version mismatch): Kernel aborts, no journal produced -- **Constraint violations**: Failure journal produced with `execution_status = 0x02` and empty action commitment +**Note:** Use `--test-threads=1` to avoid parallel proof generation exhausting memory. ### Guest Program Flow 1. Read input from zkVM environment 2. Decode and validate `KernelInputV1` -3. Verify protocol version +3. Verify protocol version and agent code hash 4. Compute input commitment -5. Execute agent with bounded input +5. Execute agent via `agent_main()` entrypoint 6. Enforce constraints (mandatory, unskippable) 7. Construct canonical journal (Success or Failure) 8. Commit journal or abort on hard error +## On-Chain Verification + +The E2E tests extract data needed for Solidity verifier integration: + +```rust +// From receipt after proof generation +seal: bytes // 256-byte Groth16 proof +journal: bytes // KernelJournalV1 (variable length) +imageId: bytes32 // ZKVM_GUEST_ID (guest identity) +``` + ## Usage ### Quick Start ```bash # Clone and test the implementation -git clone +git clone https://github.com/Defiesta/execution-kernel.git cd execution-kernel cargo test - -# All tests should pass with output: -# test result: ok. 82 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ``` ### Creating a Kernel Input @@ -118,7 +117,7 @@ let input = KernelInputV1 { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: example_agent::AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 1, @@ -168,13 +167,16 @@ Any deviation from these principles breaks protocol consensus. - `docs/P0.2_DOCUMENTATION.md` - Canonical codec specification - `docs/P0.3_DOCUMENTATION.md` - Constraint system documentation - `spec/codec.md` - Wire format specification -- `spec/constraints.md` - Constraint system specification (locked) +- `spec/constraints.md` - Constraint system specification +- `spec/sdk.md` - Kernel SDK specification +- `spec/e2e-tests.md` - E2E testing specification ## Security Considerations The kernel assumes a **malicious host environment** and defends against: - **Input forgery attempts** - All inputs are cryptographically committed via SHA-256 +- **Agent substitution attacks** - `agent_code_hash` binding prevents unauthorized agents - **Constraint bypass attempts** - Constraint checking is mandatory and unskippable - **Non-determinism exploitation** - Strict deterministic execution requirements - **Protocol version confusion** - Explicit version validation on all inputs @@ -183,7 +185,7 @@ The kernel assumes a **malicious host environment** and defends against: All security properties are enforced cryptographically through zkVM proofs. -**Note:** The `action.target` field is not validated by the constraint engine in P0.3. Executor contracts are responsible for target validation. +**Note:** The `action.target` field is not validated by the constraint engine. Executor contracts are responsible for target validation. ## License diff --git a/crates/e2e-tests/Cargo.toml b/crates/e2e-tests/Cargo.toml new file mode 100644 index 0000000..6028b1f --- /dev/null +++ b/crates/e2e-tests/Cargo.toml @@ -0,0 +1,40 @@ +[package] +name = "e2e-tests" +version = "0.1.0" +edition = "2021" +description = "End-to-end zkVM proof tests for the execution kernel" +license = "Apache-2.0" +publish = false + +# This crate contains only tests, no library +[lib] +path = "src/lib.rs" + +[dependencies] +# Kernel crates for types and encoding +kernel-core = { path = "../kernel-core" } +kernel-sdk = { path = "../kernel-sdk" } +constraints = { path = "../constraints" } + +# Agent code hash for input construction +example-agent = { path = "../example-agent" } + +# Methods crate provides the guest ELF and IMAGE_ID +methods = { path = "../methods", optional = true } + +# RISC Zero prover and verifier (host-side) +risc0-zkvm = { version = "3.0", default-features = false, optional = true } + +[dev-dependencies] +# Same dependencies for tests +kernel-core = { path = "../kernel-core" } +kernel-sdk = { path = "../kernel-sdk" } +constraints = { path = "../constraints" } +example-agent = { path = "../example-agent" } +hex = "0.4" + +[features] +default = [] +# Enable this feature to run zkVM proof tests +# Requires RISC Zero toolchain installed +risc0-e2e = ["dep:methods", "dep:risc0-zkvm", "risc0-zkvm/prove"] diff --git a/crates/e2e-tests/README.md b/crates/e2e-tests/README.md new file mode 100644 index 0000000..7ae8533 --- /dev/null +++ b/crates/e2e-tests/README.md @@ -0,0 +1,177 @@ +# E2E zkVM Proof Tests + +End-to-end integration tests that verify the complete execution kernel flow using RISC Zero zkVM proofs. + +## Overview + +These tests verify: + +1. **Agent → Guest → Proof → Verification** pipeline works correctly +2. **Agent code hash binding** prevents unauthorized agent substitution +3. **Determinism** - same input always produces same output +4. **Commitment integrity** - input and action commitments are correctly computed + +## Prerequisites + +### Install RISC Zero Toolchain + +```bash +# Install cargo-risczero +cargo install cargo-risczero + +# Install the RISC Zero toolchain (includes riscv32im target) +cargo risczero install +``` + +### Verify Installation + +```bash +cargo risczero --version +``` + +## Running Tests + +### Unit Tests (no zkVM required) + +```bash +# Run unit tests without proof generation +cargo test -p e2e-tests +``` + +### Full E2E Proof Tests + +```bash +# Run with zkVM proof generation (requires RISC Zero toolchain) +cargo test -p e2e-tests --features risc0-e2e -- --nocapture +``` + +### Individual Test + +```bash +# Run specific test +cargo test -p e2e-tests --features risc0-e2e test_e2e_success_with_echo -- --nocapture +``` + +## Test Cases + +### 1. `test_e2e_success_with_echo` + +Verifies the happy path: +- Valid input with `opaque_inputs[0] == 1` (echo trigger) +- Proof generation succeeds +- Receipt verifies against IMAGE_ID +- Journal contains correct: + - `execution_status == Success` + - `input_commitment == SHA256(input_bytes)` + - `action_commitment == SHA256(encoded_echo_output)` + +### 2. `test_e2e_agent_code_hash_mismatch` + +Verifies security: +- Input with wrong `agent_code_hash` (all zeros) +- Guest execution fails with `AgentCodeHashMismatch` +- No valid proof/receipt is produced + +### 3. `test_e2e_empty_output` + +Verifies empty output handling: +- Input with `opaque_inputs[0] != 1` (no echo) +- Proof generation succeeds (empty output is valid) +- `action_commitment == EMPTY_OUTPUT_COMMITMENT` + +### 4. `test_e2e_determinism` + +Verifies deterministic execution: +- Same input run twice +- Both runs produce identical journal bytes + +## CI Integration + +These tests are **feature-gated** to avoid requiring RISC Zero in all CI environments: + +```yaml +# In CI, only run E2E tests in environments with RISC Zero installed +- name: Run E2E proof tests + if: ${{ matrix.risc0-enabled }} + run: cargo test -p e2e-tests --features risc0-e2e +``` + +For CI without RISC Zero: + +```yaml +# Unit tests always work +- name: Run unit tests + run: cargo test -p e2e-tests +``` + +## Reproducible Builds + +For deterministic guest ELF builds (useful for IMAGE_ID reproducibility): + +```bash +RISC0_USE_DOCKER=1 cargo test -p e2e-tests --features risc0-e2e +``` + +This requires Docker and uses the official RISC Zero Docker image. + +## Troubleshooting + +### "risc0-zkvm not found" + +Install the RISC Zero toolchain: + +```bash +cargo risczero install +``` + +### "failed to find riscv32im-risc0-zkvm-elf target" + +The RISC Zero toolchain may not be installed correctly. Reinstall: + +```bash +cargo risczero install --force +``` + +### Slow proof generation + +Proof generation can take several minutes. For faster iteration during development, you can use the `dev` prover mode (add `--features dev-mode` if available in your risc0-zkvm version). + +## Architecture + +``` +┌─────────────────────────────────────────────────────────────────┐ +│ e2e-tests │ +│ ┌────────────────┐ ┌────────────────┐ ┌────────────────┐ │ +│ │ Test Input │──▶│ methods crate │──▶│ Prover │ │ +│ │ (KernelInputV1)│ │ (ELF+IMAGE_ID) │ │ (risc0-zkvm) │ │ +│ └────────────────┘ └────────────────┘ └───────┬────────┘ │ +│ │ │ +│ ┌────────▼────────┐ │ +│ │ Receipt │ │ +│ │ (Proof+Journal) │ │ +│ └────────┬────────┘ │ +│ │ │ +│ ┌────────────────┐ ┌────────▼────────┐ │ +│ │ Decode Journal │◀───────────────────────│ Verify Receipt │ │ +│ │ (KernelJournalV1)│ │ (IMAGE_ID) │ │ +│ └────────┬───────┘ └─────────────────┘ │ +│ │ │ +│ ┌────────▼───────┐ │ +│ │ Assert Fields │ │ +│ │ (status, etc.) │ │ +│ └────────────────┘ │ +└─────────────────────────────────────────────────────────────────┘ +``` + +## Files + +- `src/lib.rs` - Test implementations and helper functions +- `Cargo.toml` - Dependencies with `risc0-e2e` feature gate +- `README.md` - This file + +## Related Crates + +- `methods` - Builds kernel-guest as RISC Zero guest, exports ELF/IMAGE_ID +- `kernel-guest` - The guest program that runs in zkVM +- `example-agent` - Provides `agent_main` and `AGENT_CODE_HASH` +- `kernel-core` - Types and encoding used by both host and guest diff --git a/crates/e2e-tests/src/lib.rs b/crates/e2e-tests/src/lib.rs new file mode 100644 index 0000000..75cd196 --- /dev/null +++ b/crates/e2e-tests/src/lib.rs @@ -0,0 +1,398 @@ +//! End-to-End zkVM Proof Tests +//! +//! This crate provides integration tests that verify the complete execution flow: +//! Agent → Guest Build → Input Generation → zkVM Execution → Proof → Verification +//! +//! # Test Coverage +//! +//! 1. **Success Path**: Valid input with echo action produces valid proof +//! 2. **Hash Mismatch**: Wrong agent_code_hash fails during guest execution +//! 3. **Empty Output**: No-echo input produces empty output with correct commitment +//! +//! # Running Tests +//! +//! ```bash +//! # Install RISC Zero toolchain first +//! cargo install cargo-risczero +//! cargo risczero install +//! +//! # Run E2E proof tests +//! cargo test -p e2e-tests --features risc0-e2e -- --nocapture +//! ``` +//! +//! # CI Integration +//! +//! These tests are gated behind the `risc0-e2e` feature to allow CI to run +//! without the RISC Zero toolchain installed. Add `--features risc0-e2e` to +//! enable proof generation in CI environments with RISC Zero available. + +#![cfg_attr(not(feature = "risc0-e2e"), allow(dead_code))] + +use kernel_core::{ + compute_action_commitment, compute_input_commitment, AgentOutput, CanonicalDecode, + CanonicalEncode, ExecutionStatus, KernelInputV1, KernelJournalV1, KERNEL_VERSION, + PROTOCOL_VERSION, +}; + +/// Helper to construct a valid KernelInputV1 with the correct agent_code_hash. +/// +/// Uses `example_agent::AGENT_CODE_HASH` to ensure hash verification passes. +pub fn make_valid_input(opaque_agent_inputs: Vec) -> KernelInputV1 { + KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: example_agent::AGENT_CODE_HASH, + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 1, + opaque_agent_inputs, + } +} + +/// Helper to construct a KernelInputV1 with a WRONG agent_code_hash. +/// +/// Used to test that hash mismatches cause execution failures. +pub fn make_input_with_wrong_hash(opaque_agent_inputs: Vec) -> KernelInputV1 { + KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0x00; 32], // Wrong hash - all zeros + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 1, + opaque_agent_inputs, + } +} + +/// Compute the expected action commitment for an echo output. +/// +/// When the example-agent echoes, it produces: +/// - action_type: 0x00000001 (ECHO) +/// - target: agent_id +/// - payload: opaque_inputs (truncated to MAX_ACTION_PAYLOAD_BYTES) +pub fn compute_echo_commitment(agent_id: [u8; 32], payload: &[u8]) -> [u8; 32] { + use kernel_core::ActionV1; + use kernel_sdk::types::MAX_ACTION_PAYLOAD_BYTES; + + let payload_len = payload.len().min(MAX_ACTION_PAYLOAD_BYTES); + let action = ActionV1 { + action_type: 0x00000001, // ACTION_TYPE_ECHO + target: agent_id, + payload: payload[..payload_len].to_vec(), + }; + + let output = AgentOutput { + actions: vec![action], + }; + + let output_bytes = output.encode().expect("encode should succeed"); + compute_action_commitment(&output_bytes) +} + +// ============================================================================ +// zkVM Proof Tests (require risc0-e2e feature) +// ============================================================================ + +#[cfg(all(test, feature = "risc0-e2e"))] +mod zkvm_tests { + use super::*; + use constraints::EMPTY_OUTPUT_COMMITMENT; + use methods::{ZKVM_GUEST_ELF, ZKVM_GUEST_ID}; + use risc0_zkvm::{default_prover, ExecutorEnv, ProverOpts}; + + /// Test 1: Successful execution with echo action produces valid proof. + /// + /// This test verifies the complete happy path: + /// 1. Construct valid input with echo trigger (first byte = 1) + /// 2. Run zkVM prover to execute kernel-guest + /// 3. Verify receipt against IMAGE_ID + /// 4. Decode journal and verify: + /// - execution_status == Success + /// - input_commitment matches SHA256(input_bytes) + /// - action_commitment matches expected echo output + #[test] + fn test_e2e_success_with_echo() { + // Construct input that triggers echo (first byte = 1) + let opaque_inputs = vec![1, 2, 3, 4, 5]; + let input = make_valid_input(opaque_inputs.clone()); + let input_bytes = input.encode().expect("encode should succeed"); + + // Build executor environment with input + // Use .write() to serialize the Vec so env::read() can deserialize it + let env = ExecutorEnv::builder() + .write(&input_bytes) + .expect("failed to write input") + .build() + .expect("failed to build executor env"); + + // Run the prover + println!("Starting zkVM proof generation..."); + let prover = default_prover(); + let prove_info = prover + .prove_with_opts(env, ZKVM_GUEST_ELF, &ProverOpts::groth16()) + .expect("proof generation failed"); + + println!("Proof generated successfully!"); + + // Extract the receipt + let receipt = prove_info.receipt; + + // Verify the receipt against IMAGE_ID + receipt + .verify(ZKVM_GUEST_ID) + .expect("receipt verification failed"); + + println!("Receipt verified against IMAGE_ID"); + + // Extract the journal bytes (raw bytes committed via env::commit_slice) + let journal_bytes = receipt.journal.bytes.clone(); + let journal = + KernelJournalV1::decode(&journal_bytes).expect("KernelJournalV1 decode failed"); + + // Verify execution succeeded + assert_eq!( + journal.execution_status, + ExecutionStatus::Success, + "Expected Success status" + ); + + // Verify identity fields match input + assert_eq!(journal.protocol_version, PROTOCOL_VERSION); + assert_eq!(journal.kernel_version, KERNEL_VERSION); + assert_eq!(journal.agent_id, [0x42; 32]); + assert_eq!(journal.agent_code_hash, example_agent::AGENT_CODE_HASH); + assert_eq!(journal.constraint_set_hash, [0xbb; 32]); + assert_eq!(journal.input_root, [0xcc; 32]); + assert_eq!(journal.execution_nonce, 1); + + // Verify input commitment + let expected_input_commitment = compute_input_commitment(&input_bytes); + assert_eq!( + journal.input_commitment, expected_input_commitment, + "Input commitment mismatch" + ); + + // Verify action commitment (echo action) + let expected_action_commitment = compute_echo_commitment([0x42; 32], &opaque_inputs); + assert_eq!( + journal.action_commitment, expected_action_commitment, + "Action commitment mismatch" + ); + + // Extract seal for on-chain verification + // The seal is inside the Groth16Receipt + if let risc0_zkvm::InnerReceipt::Groth16(groth16_receipt) = &receipt.inner { + // Convert image_id [u32; 8] to bytes32 (little-endian) + let image_id_bytes: Vec = ZKVM_GUEST_ID + .iter() + .flat_map(|x| x.to_le_bytes()) + .collect(); + + println!("\n=== On-chain verification data ==="); + println!("seal (hex): 0x{}", hex::encode(&groth16_receipt.seal)); + println!("seal length: {} bytes", groth16_receipt.seal.len()); + println!("journal (hex): 0x{}", hex::encode(&receipt.journal.bytes)); + println!("journal length: {} bytes", receipt.journal.bytes.len()); + println!("image_id (bytes32): 0x{}", hex::encode(&image_id_bytes)); + println!("image_id (u32[8]): {:?}", ZKVM_GUEST_ID); + } + println!("All assertions passed!"); + } + + /// Test 2: Wrong agent_code_hash causes execution failure. + /// + /// When the input declares a different agent_code_hash than the linked agent, + /// kernel_main returns AgentCodeHashMismatch error, which causes the guest + /// to panic. This aborts proof generation - no valid receipt is produced. + #[test] + fn test_e2e_agent_code_hash_mismatch() { + // Construct input with WRONG agent_code_hash + let input = make_input_with_wrong_hash(vec![1, 2, 3]); + let input_bytes = input.encode().expect("encode should succeed"); + + // Build executor environment + let env = ExecutorEnv::builder() + .write(&input_bytes) + .expect("failed to write input") + .build() + .expect("failed to build executor env"); + + // Run the prover - should fail because guest panics + println!("Starting zkVM proof generation (expecting failure)..."); + let prover = default_prover(); + let result = prover.prove_with_opts(env, ZKVM_GUEST_ELF, &ProverOpts::groth16()); + + // Proof generation should fail + assert!( + result.is_err(), + "Expected proof generation to fail due to hash mismatch" + ); + + // Verify the error message mentions the panic + let err = result.unwrap_err(); + let err_string = format!("{:?}", err); + println!("Got expected error: {}", err_string); + + // The error should indicate guest execution failed + // (exact error message depends on risc0-zkvm version) + assert!( + err_string.contains("panic") + || err_string.contains("failed") + || err_string.contains("execution"), + "Error should indicate execution failure" + ); + + println!("Hash mismatch correctly caused execution failure!"); + } + + /// Test 3: Empty output when no-echo trigger produces correct commitment. + /// + /// When opaque_inputs[0] != 1, the example-agent produces no actions. + /// This should: + /// - Still succeed (empty output is valid) + /// - Have action_commitment == EMPTY_OUTPUT_COMMITMENT + #[test] + fn test_e2e_empty_output() { + // Construct input that does NOT trigger echo (first byte = 0) + let opaque_inputs = vec![0, 2, 3, 4, 5]; + let input = make_valid_input(opaque_inputs); + let input_bytes = input.encode().expect("encode should succeed"); + + // Build executor environment + let env = ExecutorEnv::builder() + .write(&input_bytes) + .expect("failed to write input") + .build() + .expect("failed to build executor env"); + + // Run the prover + println!("Starting zkVM proof generation (empty output case)..."); + let prover = default_prover(); + let prove_info = prover + .prove_with_opts(env, ZKVM_GUEST_ELF, &ProverOpts::groth16()) + .expect("proof generation failed"); + + println!("Proof generated successfully!"); + + // Verify receipt + let receipt = prove_info.receipt; + receipt + .verify(ZKVM_GUEST_ID) + .expect("receipt verification failed"); + + // Extract the journal bytes (raw bytes committed via env::commit_slice) + let journal_bytes = receipt.journal.bytes.clone(); + let journal = + KernelJournalV1::decode(&journal_bytes).expect("KernelJournalV1 decode failed"); + + // Verify execution succeeded (empty output is valid) + assert_eq!( + journal.execution_status, + ExecutionStatus::Success, + "Expected Success status for empty output" + ); + + // Verify action commitment is the empty output commitment + assert_eq!( + journal.action_commitment, EMPTY_OUTPUT_COMMITMENT, + "Expected EMPTY_OUTPUT_COMMITMENT for no-echo case" + ); + + // Also verify against manually computed empty commitment + let empty_output = AgentOutput { actions: vec![] }; + let empty_bytes = empty_output.encode().expect("encode should succeed"); + let expected_commitment = compute_action_commitment(&empty_bytes); + assert_eq!( + journal.action_commitment, expected_commitment, + "Empty commitment should match computed value" + ); + + println!("Empty output test passed!"); + } + + /// Test 4: Determinism - same input produces same journal. + /// + /// Running the same input twice should produce identical journal bytes, + /// demonstrating deterministic execution. + #[test] + fn test_e2e_determinism() { + // Construct input + let input = make_valid_input(vec![1, 0xde, 0xad, 0xbe, 0xef]); + let input_bytes = input.encode().expect("encode should succeed"); + + // Run prover twice + let mut journals = Vec::new(); + + for i in 0..2 { + println!("Determinism test: run {}/2", i + 1); + + let env = ExecutorEnv::builder() + .write(&input_bytes) + .expect("failed to write input") + .build() + .expect("failed to build executor env"); + + let prover = default_prover(); + let prove_info = prover + .prove_with_opts(env, ZKVM_GUEST_ELF, &ProverOpts::groth16()) + .expect("proof generation failed"); + + let journal_bytes = prove_info.receipt.journal.bytes.clone(); + journals.push(journal_bytes); + } + + // Journals should be identical + assert_eq!( + journals[0], journals[1], + "Determinism violated: journals differ" + ); + + println!("Determinism verified: both runs produced identical journals"); + } +} + +// ============================================================================ +// Non-zkVM Tests (always run) +// ============================================================================ + +#[cfg(test)] +mod unit_tests { + use super::*; + + #[test] + fn test_make_valid_input_uses_correct_hash() { + let input = make_valid_input(vec![1, 2, 3]); + assert_eq!(input.agent_code_hash, example_agent::AGENT_CODE_HASH); + } + + #[test] + fn test_make_input_with_wrong_hash_is_wrong() { + let input = make_input_with_wrong_hash(vec![1, 2, 3]); + assert_ne!(input.agent_code_hash, example_agent::AGENT_CODE_HASH); + assert_eq!(input.agent_code_hash, [0x00; 32]); + } + + #[test] + fn test_compute_echo_commitment_is_deterministic() { + let agent_id = [0x42; 32]; + let payload = vec![1, 2, 3, 4, 5]; + + let commitment1 = compute_echo_commitment(agent_id, &payload); + let commitment2 = compute_echo_commitment(agent_id, &payload); + + assert_eq!(commitment1, commitment2); + } + + #[test] + fn test_input_encoding_roundtrip() { + let input = make_valid_input(vec![1, 2, 3, 4, 5]); + let encoded = input.encode().expect("encode should succeed"); + let decoded = KernelInputV1::decode(&encoded).expect("decode should succeed"); + + assert_eq!(decoded.protocol_version, input.protocol_version); + assert_eq!(decoded.agent_code_hash, input.agent_code_hash); + assert_eq!(decoded.opaque_agent_inputs, input.opaque_agent_inputs); + } +} diff --git a/crates/example-agent/Cargo.toml b/crates/example-agent/Cargo.toml index 49e69b4..d8e3aa2 100644 --- a/crates/example-agent/Cargo.toml +++ b/crates/example-agent/Cargo.toml @@ -10,3 +10,6 @@ crate-type = ["rlib"] [dependencies] kernel-sdk = { path = "../kernel-sdk" } + +[build-dependencies] +sha2 = "0.10" diff --git a/crates/example-agent/build.rs b/crates/example-agent/build.rs new file mode 100644 index 0000000..e33c747 --- /dev/null +++ b/crates/example-agent/build.rs @@ -0,0 +1,130 @@ +//! Build script for example-agent +//! +//! Generates a compile-time constant `AGENT_CODE_HASH` that uniquely identifies +//! this agent's source code. This hash is used by the kernel to verify that +//! the `agent_code_hash` field in `KernelInputV1` matches the actually-linked +//! agent binary. +//! +//! # What is Hashed (DEV Mode) +//! +//! In the current MVP implementation, we hash the agent's source files: +//! - `src/lib.rs` - Main agent implementation +//! - `Cargo.toml` - Dependencies and build configuration +//! +//! The hash is computed as: SHA256(src/lib.rs || 0x00 || Cargo.toml) +//! +//! # Why Source Hashing (Temporary) +//! +//! Hashing compiled artifacts (.rlib) is complex because: +//! - rlib paths depend on build configuration and target +//! - Incremental compilation creates varying outputs +//! - Cross-compilation adds further complexity +//! +//! Source hashing provides determinism for development while we design +//! the production artifact hashing mechanism. +//! +//! # Production Considerations +//! +//! In production deployments with dynamic agents, this will be replaced by: +//! - Hashing the zkVM guest ELF binary +//! - Using the RISC Zero image ID +//! - Or hashing a canonical deployment artifact +//! +//! # Binding the Proof to Agent Code +//! +//! This hash creates a cryptographic binding between: +//! 1. The `agent_code_hash` declared in `KernelInputV1` (what the verifier expects) +//! 2. The actual agent code linked into the guest (what actually runs) +//! +//! If these don't match, the kernel rejects execution with `AgentCodeHashMismatch`. +//! This prevents: +//! - Proofs generated with one agent from being replayed with different agent code +//! - Malicious substitution of agent implementations +//! - Version confusion in multi-agent deployments + +use sha2::{Digest, Sha256}; +use std::env; +use std::fs; +use std::io::Write; +use std::path::Path; + +fn main() { + let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"); + let manifest_path = Path::new(&manifest_dir); + + // Files to hash (deterministic order) + let files_to_hash = ["src/lib.rs", "Cargo.toml"]; + + // Rerun if any source file changes + for file in &files_to_hash { + let path = manifest_path.join(file); + println!("cargo:rerun-if-changed={}", path.display()); + } + + // Also rerun if build.rs itself changes + println!("cargo:rerun-if-changed=build.rs"); + + // Compute hash: SHA256(file1 || 0x00 || file2 || 0x00 || ...) + let mut hasher = Sha256::new(); + + for (i, file) in files_to_hash.iter().enumerate() { + let path = manifest_path.join(file); + let content = fs::read(&path) + .unwrap_or_else(|e| panic!("Failed to read {}: {}", path.display(), e)); + + hasher.update(&content); + + // Add separator between files (not after last file) + if i < files_to_hash.len() - 1 { + hasher.update(&[0x00]); + } + } + + let hash: [u8; 32] = hasher.finalize().into(); + + // Generate Rust source file + let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set"); + let out_path = Path::new(&out_dir).join("agent_hash.rs"); + + let mut file = fs::File::create(&out_path) + .unwrap_or_else(|e| panic!("Failed to create {}: {}", out_path.display(), e)); + + writeln!(file, "// Auto-generated by build.rs - DO NOT EDIT").unwrap(); + writeln!(file, "//").unwrap(); + writeln!(file, "// This hash uniquely identifies the agent source code.").unwrap(); + writeln!(file, "// It is computed as SHA256(src/lib.rs || 0x00 || Cargo.toml).").unwrap(); + writeln!(file, "//").unwrap(); + writeln!(file, "// NOTE: This is a DEV hash based on source files.").unwrap(); + writeln!(file, "// Production deployments will use artifact hashing.").unwrap(); + writeln!(file).unwrap(); + writeln!( + file, + "/// SHA-256 hash of the agent source code." + ) + .unwrap(); + writeln!(file, "///").unwrap(); + writeln!(file, "/// This constant binds the zkVM proof to this specific agent implementation.").unwrap(); + writeln!(file, "/// The kernel verifies that `KernelInputV1.agent_code_hash` matches this value").unwrap(); + writeln!(file, "/// before executing the agent. A mismatch results in `KernelError::AgentCodeHashMismatch`.").unwrap(); + writeln!(file, "///").unwrap(); + writeln!(file, "/// # What is Hashed").unwrap(); + writeln!(file, "///").unwrap(); + writeln!(file, "/// DEV mode: `SHA256(src/lib.rs || 0x00 || Cargo.toml)`").unwrap(); + writeln!(file, "///").unwrap(); + writeln!(file, "/// # When This Changes").unwrap(); + writeln!(file, "///").unwrap(); + writeln!(file, "/// Any modification to the hashed source files will produce a new hash.").unwrap(); + writeln!(file, "/// This includes whitespace changes, comments, and dependency updates.").unwrap(); + write!(file, "pub const AGENT_CODE_HASH: [u8; 32] = [").unwrap(); + for (i, byte) in hash.iter().enumerate() { + if i > 0 { + write!(file, ", ").unwrap(); + } + write!(file, "0x{:02x}", byte).unwrap(); + } + writeln!(file, "];").unwrap(); + + // Print hash for build logs (useful for debugging) + let hash_hex: String = hash.iter().map(|b| format!("{:02x}", b)).collect(); + println!("cargo:warning=AGENT_CODE_HASH: {}", hash_hex); +} diff --git a/crates/example-agent/src/lib.rs b/crates/example-agent/src/lib.rs index 81bbb4e..efe172a 100644 --- a/crates/example-agent/src/lib.rs +++ b/crates/example-agent/src/lib.rs @@ -11,17 +11,29 @@ //! - Otherwise → Empty output (no actions) //! //! This allows testing both action-producing and no-action execution paths. +//! +//! # Agent Code Hash +//! +//! This crate exports [`AGENT_CODE_HASH`], a compile-time constant that uniquely +//! identifies this agent's source code. The kernel uses this to verify that the +//! `agent_code_hash` field in `KernelInputV1` matches the linked agent. +//! +//! See the `build.rs` file for details on how the hash is computed. #![no_std] -// Use `deny` instead of `forbid` to allow targeted exception for #[no_mangle] -// The #[no_mangle] attribute is required for the canonical agent_main symbol, -// and triggers the unsafe_code lint because symbol collisions are UB. +// We use `deny` instead of `forbid` because `#[no_mangle]` triggers the +// unsafe_code lint in modern Rust (symbol collisions are UB). The allow +// is scoped to only the agent_main function. #![deny(unsafe_code)] extern crate alloc; use kernel_sdk::prelude::*; +// Include the generated agent hash constant. +// This is created by build.rs and contains AGENT_CODE_HASH. +include!(concat!(env!("OUT_DIR"), "/agent_hash.rs")); + /// Canonical agent entrypoint. /// /// This function is called by the kernel to execute the agent logic. @@ -32,11 +44,19 @@ use kernel_sdk::prelude::*; /// - `ctx`: Execution context with identity and metadata /// - `opaque_inputs`: Agent-specific input data /// -/// # Safety Note +/// # Symbol Requirements /// /// The `#[no_mangle]` attribute is required so the kernel can find this symbol. -/// The `unsafe_code` lint is allowed here because the symbol name is canonical -/// and expected by the kernel - there is no risk of collision. +/// The symbol name `agent_main` is fixed by the kernel ABI specification. +/// +/// # Lint Exception +/// +/// `#[no_mangle]` triggers the `unsafe_code` lint because symbol collisions +/// can cause undefined behavior. The `#[allow(unsafe_code)]` is scoped to +/// this function only, and is safe because: +/// - The symbol `agent_main` is the canonical entrypoint defined by the kernel ABI +/// - Only one agent is linked per guest binary +/// - The kernel explicitly expects this exact symbol name #[no_mangle] #[allow(unsafe_code)] pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { @@ -58,6 +78,19 @@ pub extern "Rust" fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> Age } } +// ============================================================================ +// Compile-time ABI Verification +// ============================================================================ + +/// Compile-time check that agent_main matches the canonical AgentEntrypoint type. +/// +/// This ensures the function signature is correct at compile time rather than +/// failing at link time with a cryptic error. +/// +/// NOTE: `extern "Rust"` requires the agent and kernel to be compiled with +/// the same rustc toolchain. The workspace pins the toolchain for determinism. +const _: AgentEntrypoint = agent_main; + #[cfg(test)] mod tests { use super::*; diff --git a/crates/host-tests/src/lib.rs b/crates/host-tests/src/lib.rs index 57103d5..6e1d9ac 100644 --- a/crates/host-tests/src/lib.rs +++ b/crates/host-tests/src/lib.rs @@ -3,6 +3,9 @@ // which must be provided by a linked agent crate. extern crate example_agent; +// Re-export the agent code hash for tests to use. +pub use example_agent::AGENT_CODE_HASH; + #[cfg(test)] mod tests { use kernel_core::*; @@ -14,13 +17,38 @@ mod tests { use kernel_guest::kernel_main; use constraints::EMPTY_OUTPUT_COMMITMENT; - /// Helper to create a valid KernelInputV1 with default values + // Import the agent code hash from the linked example-agent crate. + // This is the compile-time constant that the kernel verifies against. + use crate::AGENT_CODE_HASH; + + /// Helper to create a valid KernelInputV1 with the correct agent_code_hash. + /// + /// This uses `AGENT_CODE_HASH` from the linked example-agent crate, + /// ensuring the hash verification in kernel_main will pass. fn make_input(agent_input: Vec) -> KernelInputV1 { KernelInputV1 { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Correct hash from linked agent + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 1, + opaque_agent_inputs: agent_input, + } + } + + /// Helper to create a KernelInputV1 with a WRONG agent_code_hash. + /// + /// This uses a dummy hash that will NOT match the linked agent, + /// useful for testing hash mismatch scenarios. + #[allow(dead_code)] + fn make_input_with_wrong_hash(agent_input: Vec) -> KernelInputV1 { + KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xde; 32], // Wrong hash - will fail hash check constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 1, @@ -349,7 +377,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x11; 32], - agent_code_hash: [0x22; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0x33; 32], input_root: [0x44; 32], execution_nonce: 9999, @@ -362,7 +390,7 @@ mod tests { // Verify identity fields are copied to journal assert_eq!(journal.agent_id, [0x11; 32]); - assert_eq!(journal.agent_code_hash, [0x22; 32]); + assert_eq!(journal.agent_code_hash, AGENT_CODE_HASH); assert_eq!(journal.constraint_set_hash, [0x33; 32]); assert_eq!(journal.input_root, [0x44; 32]); assert_eq!(journal.execution_nonce, 9999); @@ -471,7 +499,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 1, @@ -1785,7 +1813,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 1, @@ -1801,7 +1829,7 @@ mod tests { // Verify identity fields are preserved assert_eq!(journal.agent_id, [0x42; 32]); - assert_eq!(journal.agent_code_hash, [0xaa; 32]); + assert_eq!(journal.agent_code_hash, AGENT_CODE_HASH); assert_eq!(journal.constraint_set_hash, [0xbb; 32]); assert_eq!(journal.input_root, [0xcc; 32]); assert_eq!(journal.execution_nonce, 1); @@ -1818,7 +1846,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 2, @@ -1843,7 +1871,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 3, @@ -1868,7 +1896,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 4, @@ -1907,7 +1935,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x11; 32], - agent_code_hash: [0x22; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0x33; 32], input_root: [0x44; 32], execution_nonce: 100, @@ -1937,7 +1965,7 @@ mod tests { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, agent_id: [0x42; 32], - agent_code_hash: [0xaa; 32], + agent_code_hash: AGENT_CODE_HASH, // Must match linked agent constraint_set_hash: [0xbb; 32], input_root: [0xcc; 32], execution_nonce: 5, @@ -1961,6 +1989,108 @@ mod tests { assert_eq!(journal.action_commitment, EMPTY_OUTPUT_COMMITMENT); } + // ======================================================================== + // P0.5: Agent Code Hash Binding Tests + // ======================================================================== + + #[test] + fn test_agent_code_hash_match_passes() { + // When agent_code_hash matches the linked agent, execution succeeds. + // This test verifies that the hash binding works correctly. + let input = make_input(vec![1, 2, 3, 4, 5]); // Echo input (make_input uses correct hash) + + let input_bytes = input.encode().unwrap(); + let result = kernel_main(&input_bytes); + + // Should succeed because hash matches + assert!(result.is_ok(), "Expected success but got: {:?}", result); + + let journal_bytes = result.unwrap(); + let journal = KernelJournalV1::decode(&journal_bytes).unwrap(); + + // Verify SUCCESS status + assert_eq!(journal.execution_status, ExecutionStatus::Success); + + // Verify the journal contains the correct agent_code_hash + assert_eq!(journal.agent_code_hash, AGENT_CODE_HASH); + } + + #[test] + fn test_agent_code_hash_mismatch_fails() { + // When agent_code_hash does NOT match the linked agent, execution fails. + // This test verifies that the kernel rejects mismatched hashes. + let wrong_hash = [0xde; 32]; // Wrong hash + + let input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: wrong_hash, // WRONG hash + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 1, + opaque_agent_inputs: vec![1, 2, 3], // Echo input + }; + + let input_bytes = input.encode().unwrap(); + let result = kernel_main(&input_bytes); + + // Should fail with AgentCodeHashMismatch + assert!(result.is_err(), "Expected error but got success"); + assert!( + matches!(result, Err(KernelError::AgentCodeHashMismatch)), + "Expected AgentCodeHashMismatch but got: {:?}", + result + ); + } + + #[test] + fn test_agent_code_hash_with_constraints() { + // Test that agent code hash verification works with custom constraints too. + use constraints::ConstraintSetV1; + use kernel_guest::kernel_main_with_constraints; + + // With valid hash - should succeed + let valid_input = make_input(vec![1, 2, 3]); // make_input uses correct hash + let constraints = ConstraintSetV1::default(); + let input_bytes = valid_input.encode().unwrap(); + let result = kernel_main_with_constraints(&input_bytes, &constraints); + assert!(result.is_ok(), "Expected success with valid hash"); + + // With invalid hash - should fail + let invalid_input = KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: [0xff; 32], // WRONG hash + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 2, + opaque_agent_inputs: vec![1, 2, 3], + }; + let input_bytes = invalid_input.encode().unwrap(); + let result = kernel_main_with_constraints(&input_bytes, &constraints); + assert!( + matches!(result, Err(KernelError::AgentCodeHashMismatch)), + "Expected AgentCodeHashMismatch but got: {:?}", + result + ); + } + + #[test] + fn test_agent_code_hash_constant_is_stable() { + // Verify the agent code hash is a 32-byte value (sanity check). + // The actual hash value will change when agent source changes, + // but the format should always be 32 bytes. + assert_eq!(AGENT_CODE_HASH.len(), 32); + + // Hash should not be all zeros (would indicate a problem) + assert_ne!(AGENT_CODE_HASH, [0u8; 32], "Agent hash should not be all zeros"); + + // Hash should not be all 0xFF (would indicate a problem) + assert_ne!(AGENT_CODE_HASH, [0xffu8; 32], "Agent hash should not be all 0xFF"); + } + // ======================================================================== // Test Helpers // ======================================================================== diff --git a/crates/kernel-guest/Cargo.toml b/crates/kernel-guest/Cargo.toml index 5189c28..64da5a6 100644 --- a/crates/kernel-guest/Cargo.toml +++ b/crates/kernel-guest/Cargo.toml @@ -11,7 +11,10 @@ kernel-sdk = { path = "../kernel-sdk" } constraints = { path = "../constraints" } example-agent = { path = "../example-agent", optional = true } +# RISC Zero zkVM guest runtime (only needed when building for zkVM) +risc0-zkvm = { version = "3.0", default-features = false, features = ["std"], optional = true } + [features] default = ["example-agent"] -risc0 = [] +risc0 = ["dep:risc0-zkvm"] example-agent = ["dep:example-agent"] \ No newline at end of file diff --git a/crates/kernel-guest/src/lib.rs b/crates/kernel-guest/src/lib.rs index 3a9b193..e2507d8 100644 --- a/crates/kernel-guest/src/lib.rs +++ b/crates/kernel-guest/src/lib.rs @@ -8,23 +8,41 @@ //! //! 1. Decode input bytes → `KernelInputV1` //! 2. Validate protocol and kernel versions -//! 3. Compute input commitment (SHA256) -//! 4. Build `AgentContext` from kernel input -//! 5. Call `agent_main` via `extern "Rust"` ABI -//! 6. Enforce constraints on agent output (UNSKIPPABLE) -//! 7. Compute action commitment (SHA256) -//! 8. Return encoded `KernelJournalV1` +//! 3. **Verify agent code hash matches linked agent** (P0.5) +//! 4. Compute input commitment (SHA256) +//! 5. Build `AgentContext` from kernel input +//! 6. Call `agent_main` via `extern "Rust"` ABI +//! 7. Enforce constraints on agent output (UNSKIPPABLE) +//! 8. Compute action commitment (SHA256) +//! 9. Return encoded `KernelJournalV1` //! //! # Agent Entrypoint //! //! The agent is invoked through an `extern "Rust"` function with the symbol //! `agent_main`. This function is linked at compile time (for static //! agents like `example-agent`) or at load time (for dynamic agents). +//! +//! # Agent Code Hash Binding (P0.5) +//! +//! When the `example-agent` feature is enabled, the kernel verifies that +//! `KernelInputV1.agent_code_hash` matches the hash of the linked agent +//! (`example_agent::AGENT_CODE_HASH`). This binding ensures: +//! +//! - Proofs are tied to the specific agent implementation that ran +//! - Malicious agent substitution is detected and rejected +//! - Verifiers can trust that the claimed agent actually executed +//! +//! If the hash doesn't match, `KernelError::AgentCodeHashMismatch` is returned. use kernel_core::*; use kernel_sdk::agent::AgentContext; use constraints::{enforce_constraints, ConstraintSetV1, EMPTY_OUTPUT_COMMITMENT}; +// Import the agent code hash when example-agent feature is enabled. +// This constant is generated at build time by example-agent's build.rs. +#[cfg(feature = "example-agent")] +use example_agent::AGENT_CODE_HASH as LINKED_AGENT_CODE_HASH; + // ============================================================================ // Agent Entrypoint Declaration // ============================================================================ @@ -36,6 +54,10 @@ use constraints::{enforce_constraints, ConstraintSetV1, EMPTY_OUTPUT_COMMITMENT} // Using `extern "Rust"` is safe for Rust types like &AgentContext and // AgentOutput (which contains Vec). This avoids the ABI-safety issues // that would arise with `extern "C"`. +// +// IMPORTANT: `extern "Rust"` requires the agent and kernel to be compiled +// with the same rustc toolchain. The workspace pins the toolchain via +// rust-toolchain.toml to ensure deterministic builds and ABI compatibility. extern "Rust" { fn agent_main(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput; } @@ -56,11 +78,19 @@ fn call_agent(ctx: &AgentContext, opaque_inputs: &[u8]) -> AgentOutput { /// This is the core execution logic that: /// 1. Decodes and validates input /// 2. Verifies protocol and kernel versions -/// 3. Computes input commitment -/// 4. Executes the agent via `agent_main` -/// 5. Enforces constraints on agent output (UNSKIPPABLE) -/// 6. Computes action commitment -/// 7. Constructs and returns the journal +/// 3. Verifies agent code hash matches linked agent (P0.5) +/// 4. Computes input commitment +/// 5. Executes the agent via `agent_main` +/// 6. Enforces constraints on agent output (UNSKIPPABLE) +/// 7. Computes action commitment +/// 8. Constructs and returns the journal +/// +/// # P0.5 Agent Code Hash Binding +/// +/// When the `example-agent` feature is enabled, step 3 verifies that +/// `KernelInputV1.agent_code_hash` matches the compile-time constant +/// `LINKED_AGENT_CODE_HASH` from the linked agent crate. This ensures +/// proofs are cryptographically bound to specific agent code. /// /// # P0.3 Constraint Enforcement /// @@ -105,10 +135,26 @@ pub fn kernel_main(input_bytes: &[u8]) -> Result, KernelError> { }); } - // 3. Compute input commitment (over full input bytes) + // 3. Verify agent code hash matches linked agent (P0.5 binding) + // + // This check ensures that the agent_code_hash declared in the input + // matches the actual agent linked into this guest binary. Without this, + // a malicious prover could claim they ran agent X but actually run agent Y. + // + // When example-agent feature is enabled, we compare against the + // compile-time constant LINKED_AGENT_CODE_HASH from example_agent crate. + // When the feature is disabled, there is no linked agent to verify. + #[cfg(feature = "example-agent")] + { + if input.agent_code_hash != LINKED_AGENT_CODE_HASH { + return Err(KernelError::AgentCodeHashMismatch); + } + } + + // 4. Compute input commitment (over full input bytes) let input_commitment = compute_input_commitment(input_bytes); - // 4. Build agent context from input (using kernel-sdk AgentContext) + // 5. Build agent context from input (using kernel-sdk AgentContext) let agent_ctx = AgentContext::new( input.protocol_version, input.kernel_version, @@ -119,13 +165,13 @@ pub fn kernel_main(input_bytes: &[u8]) -> Result, KernelError> { input.execution_nonce, ); - // 5. Execute agent via canonical agent_main entrypoint + // 6. Execute agent via canonical agent_main entrypoint let agent_output = call_agent(&agent_ctx, &input.opaque_agent_inputs); - // 6. Get constraint set (P0.3: use default permissive constraints) + // 7. Get constraint set (P0.3: use default permissive constraints) let constraint_set = ConstraintSetV1::default(); - // 7. ENFORCE CONSTRAINTS (UNSKIPPABLE) + // 8. ENFORCE CONSTRAINTS (UNSKIPPABLE) // This is the critical safety check that validates all agent actions. let (validated_output, execution_status) = match enforce_constraints(&input, &agent_output, &constraint_set) { @@ -141,7 +187,7 @@ pub fn kernel_main(input_bytes: &[u8]) -> Result, KernelError> { } }; - // 8. Compute action commitment + // 9. Compute action commitment // On Success: computed over validated output // On Failure: computed over empty output (deterministic constant) let action_commitment = if execution_status == ExecutionStatus::Success { @@ -154,7 +200,7 @@ pub fn kernel_main(input_bytes: &[u8]) -> Result, KernelError> { EMPTY_OUTPUT_COMMITMENT }; - // 9. Construct journal with all identity and commitment fields + // 10. Construct journal with all identity and commitment fields let journal = KernelJournalV1 { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, @@ -198,10 +244,18 @@ pub fn kernel_main_with_constraints( }); } - // 3. Compute input commitment + // 3. Verify agent code hash matches linked agent (P0.5 binding) + #[cfg(feature = "example-agent")] + { + if input.agent_code_hash != LINKED_AGENT_CODE_HASH { + return Err(KernelError::AgentCodeHashMismatch); + } + } + + // 4. Compute input commitment let input_commitment = compute_input_commitment(input_bytes); - // 4. Build agent context (using kernel-sdk AgentContext) + // 5. Build agent context (using kernel-sdk AgentContext) let agent_ctx = AgentContext::new( input.protocol_version, input.kernel_version, @@ -212,17 +266,17 @@ pub fn kernel_main_with_constraints( input.execution_nonce, ); - // 5. Execute agent via canonical agent_main entrypoint + // 6. Execute agent via canonical agent_main entrypoint let agent_output = call_agent(&agent_ctx, &input.opaque_agent_inputs); - // 6. ENFORCE CONSTRAINTS (UNSKIPPABLE) + // 7. ENFORCE CONSTRAINTS (UNSKIPPABLE) let (validated_output, execution_status) = match enforce_constraints(&input, &agent_output, constraint_set) { Ok(validated) => (validated, ExecutionStatus::Success), Err(_violation) => (AgentOutput { actions: vec![] }, ExecutionStatus::Failure), }; - // 7. Compute action commitment + // 8. Compute action commitment let action_commitment = if execution_status == ExecutionStatus::Success { let output_bytes = validated_output .encode() @@ -232,7 +286,7 @@ pub fn kernel_main_with_constraints( EMPTY_OUTPUT_COMMITMENT }; - // 8. Construct and return journal + // 9. Construct and return journal let journal = KernelJournalV1 { protocol_version: PROTOCOL_VERSION, kernel_version: KERNEL_VERSION, diff --git a/crates/kernel-guest/src/main.rs b/crates/kernel-guest/src/main.rs index 998a682..fb10324 100644 --- a/crates/kernel-guest/src/main.rs +++ b/crates/kernel-guest/src/main.rs @@ -1,14 +1,34 @@ +//! RISC Zero zkVM Guest Entry Point +//! +//! This binary is compiled as a RISC Zero guest program. When executed in the zkVM: +//! 1. Reads `KernelInputV1` bytes from the host via `env::read()` +//! 2. Executes `kernel_main()` which runs the agent and enforces constraints +//! 3. Commits the `KernelJournalV1` bytes to the journal via `env::commit()` +//! +//! The journal commitment is included in the proof receipt and can be verified +//! by the host along with the IMAGE_ID. +//! +//! # Error Handling +//! +//! If kernel execution fails (e.g., version mismatch, agent code hash mismatch), +//! the guest panics. This aborts proof generation - no valid receipt is produced. +//! This is the correct behavior: failed executions should not generate proofs. + #[cfg(feature = "risc0")] fn main() { use risc0_zkvm::guest::env; - + + // Read input bytes from the host let input_bytes: Vec = env::read(); - + + // Execute kernel (agent execution + constraint enforcement) match kernel_guest::kernel_main(&input_bytes) { Ok(journal_bytes) => { - env::commit(&journal_bytes); + // Commit journal to the proof receipt + env::commit_slice(&journal_bytes); } Err(error) => { + // Panic aborts proof generation - this is intentional panic!("Kernel execution failed: {:?}", error); } } @@ -16,6 +36,7 @@ fn main() { #[cfg(not(feature = "risc0"))] fn main() { - println!("This binary is intended to run inside RISC Zero zkVM"); + eprintln!("This binary is intended to run inside RISC Zero zkVM."); + eprintln!("Build with --features risc0 and use the methods crate for E2E testing."); std::process::exit(1); } \ No newline at end of file diff --git a/crates/methods/Cargo.toml b/crates/methods/Cargo.toml new file mode 100644 index 0000000..6ab265d --- /dev/null +++ b/crates/methods/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "methods" +version = "0.1.0" +edition = "2021" +description = "RISC Zero methods crate - builds kernel-guest as zkVM guest and exports ELF/IMAGE_ID" +license = "Apache-2.0" + +[build-dependencies] +risc0-build = { version = "3.0", default-features = false } + +# Tell risc0-build which guest crate to build +# The path must be relative to this crate's directory +[package.metadata.risc0] +methods = ["zkvm-guest"] diff --git a/crates/methods/build.rs b/crates/methods/build.rs new file mode 100644 index 0000000..873ab0d --- /dev/null +++ b/crates/methods/build.rs @@ -0,0 +1,66 @@ +//! Build script for the methods crate. +//! +//! This compiles zkvm-guest as a RISC Zero guest program and generates +//! Rust source code with the ELF binary and IMAGE_ID embedded. +//! +//! zkvm-guest is a thin wrapper around kernel-guest that provides the +//! main() entry point for the zkVM execution environment. +//! +//! The generated code exports: +//! - `ZKVM_GUEST_ELF`: The compiled guest ELF binary +//! - `ZKVM_GUEST_ID`: The IMAGE_ID (hash of the ELF) +//! +//! # Build Environment +//! +//! Set `RISC0_USE_DOCKER=1` for deterministic/reproducible builds using Docker. +//! Otherwise, builds use the local risc0 toolchain. + +use std::env; +use std::path::PathBuf; + +fn main() { + // Get the manifest directory + let manifest_dir = PathBuf::from(env::var_os("CARGO_MANIFEST_DIR").unwrap()); + + // Paths to rebuild triggers + let zkvm_guest_dir = manifest_dir.join("zkvm-guest"); + let kernel_guest_dir = manifest_dir.join("..").join("kernel-guest"); + let example_agent_dir = manifest_dir.join("..").join("example-agent"); + + // Rebuild if the zkvm-guest wrapper changes + println!( + "cargo:rerun-if-changed={}", + zkvm_guest_dir.join("src").display() + ); + println!( + "cargo:rerun-if-changed={}", + zkvm_guest_dir.join("Cargo.toml").display() + ); + + // Rebuild if kernel-guest (the library) changes + println!( + "cargo:rerun-if-changed={}", + kernel_guest_dir.join("src").display() + ); + println!( + "cargo:rerun-if-changed={}", + kernel_guest_dir.join("Cargo.toml").display() + ); + + // Rebuild if example-agent changes + println!( + "cargo:rerun-if-changed={}", + example_agent_dir.join("src").display() + ); + println!( + "cargo:rerun-if-changed={}", + example_agent_dir.join("Cargo.toml").display() + ); + + println!("cargo:rerun-if-changed=build.rs"); + println!("cargo:rerun-if-env-changed=RISC0_USE_DOCKER"); + + // Build guest using risc0-build with metadata from Cargo.toml + // The [package.metadata.risc0] section specifies the guest crate path + risc0_build::embed_methods(); +} diff --git a/crates/methods/src/lib.rs b/crates/methods/src/lib.rs new file mode 100644 index 0000000..d0b6306 --- /dev/null +++ b/crates/methods/src/lib.rs @@ -0,0 +1,45 @@ +//! RISC Zero Methods Crate +//! +//! This crate provides the compiled kernel guest ELF and its IMAGE_ID for use +//! by host-side code that needs to prove and verify kernel executions. +//! +//! # Exports +//! +//! - [`ZKVM_GUEST_ELF`]: The compiled RISC Zero guest ELF binary +//! - [`ZKVM_GUEST_ID`]: The IMAGE_ID (32-byte hash identifying the guest) +//! +//! # Usage +//! +//! ```ignore +//! use methods::{ZKVM_GUEST_ELF, ZKVM_GUEST_ID}; +//! use risc0_zkvm::{default_prover, ExecutorEnv}; +//! +//! let env = ExecutorEnv::builder() +//! .write_slice(&input_bytes) +//! .build() +//! .unwrap(); +//! +//! let prover = default_prover(); +//! let receipt = prover.prove(env, ZKVM_GUEST_ELF).unwrap(); +//! +//! // Verify using IMAGE_ID +//! receipt.verify(ZKVM_GUEST_ID).unwrap(); +//! ``` +//! +//! # Architecture +//! +//! The guest is built from `zkvm-guest/`, a thin wrapper around `kernel-guest` +//! that provides the main() entry point for zkVM execution. The wrapper: +//! 1. Reads input bytes from the host via `env::read()` +//! 2. Calls `kernel_guest::kernel_main()` to execute the kernel +//! 3. Commits the resulting journal to the proof via `env::commit_slice()` +//! +//! # Determinism +//! +//! For reproducible builds, set `RISC0_USE_DOCKER=1` before building. +//! This ensures the guest ELF is built using the Docker-based RISC Zero +//! toolchain, producing identical binaries across environments. + +// Include the generated code from build.rs +// This provides ZKVM_GUEST_ELF and ZKVM_GUEST_ID constants +include!(concat!(env!("OUT_DIR"), "/methods.rs")); diff --git a/crates/methods/zkvm-guest/Cargo.lock b/crates/methods/zkvm-guest/Cargo.lock new file mode 100644 index 0000000..5fe291c --- /dev/null +++ b/crates/methods/zkvm-guest/Cargo.lock @@ -0,0 +1,1506 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-r1cs-std", + "ark-std", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0c292754729c8a190e50414fd1a37093c786c709899f29c9f7daccecfa855e" +dependencies = [ + "ahash", + "ark-crypto-primitives-macros", + "ark-ec", + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-snark", + "ark-std", + "blake2", + "derivative", + "digest", + "fnv", + "merlin", + "sha2", +] + +[[package]] +name = "ark-crypto-primitives-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e89fe77d1f0f4fe5b96dfc940923d88d17b6a773808124f21e764dfb063c6a" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "educe", + "fnv", + "hashbrown 0.15.5", + "itertools", + "num-bigint", + "num-integer", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "arrayvec", + "digest", + "educe", + "itertools", + "num-bigint", + "num-traits", + "paste", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-groth16" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f1d0f3a534bb54188b8dcc104307db6c56cdae574ddc3212aec0625740fc7e" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff", + "ark-poly", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff", + "ark-serialize", + "ark-std", + "educe", + "fnv", + "hashbrown 0.15.5", +] + +[[package]] +name = "ark-r1cs-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-relations", + "ark-std", + "educe", + "num-bigint", + "num-integer", + "num-traits", + "tracing", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff", + "ark-std", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "arrayvec", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "ark-snark" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d368e2848c2d4c129ce7679a7d0d2d612b6a274d3ea6a13bad4445d61b381b88" +dependencies = [ + "ark-ff", + "ark-relations", + "ark-serialize", + "ark-std", +] + +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3" + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "borsh" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "bytemuck" +version = "1.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbdf580320f38b612e485521afda1ee26d10cc9884efaaa750d383e13e3c5f4" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9abbd1bc6865053c427f7198e6af43bfdedc55ab791faed4fbd361d789575ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "cobs" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa961b519f0b462e3a3b4a34b64d119eeaca1d59af726fe450bbba07a9fc0a1" +dependencies = [ + "thiserror", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "constraints" +version = "0.1.0" +dependencies = [ + "kernel-core", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.114", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "embedded-io" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef1a6892d9eef45c8fa6b9e0086428a2cca8491aca8f787c534a3d6d0bcb3ced" + +[[package]] +name = "embedded-io" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edd0f118536f44f5ccd48bcb8b111bdc3de888b58c74639dfb034a357d0f206d" + +[[package]] +name = "enum-ordinalize" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a1091a7bb1f8f2c4b28f1fe2cef4980ca2d410a3d727d67ecc3178c9b0800f0" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca9601fb2d62598ee17836250842873a413586e5d7ed88b356e38ddbb0ec631" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "example-agent" +version = "0.1.0" +dependencies = [ + "kernel-sdk", + "sha2", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" +dependencies = [ + "allocator-api2", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "include_bytes_aligned" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee796ad498c8d9a1d68e477df8f754ed784ef875de1414ebdaf169f70a6a784" + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown 0.16.1", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "kernel-core" +version = "0.1.0" +dependencies = [ + "sha2", +] + +[[package]] +name = "kernel-guest" +version = "0.1.0" +dependencies = [ + "constraints", + "example-agent", + "kernel-core", + "kernel-sdk", +] + +[[package]] +name = "kernel-sdk" +version = "0.1.0" +dependencies = [ + "kernel-core", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.180" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + +[[package]] +name = "merlin" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58c38e2799fc0978b65dfff8023ec7843e2330bb462f19198840b34b6582397d" +dependencies = [ + "byteorder", + "keccak", + "rand_core 0.6.4", + "zeroize", +] + +[[package]] +name = "metal" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +dependencies = [ + "bitflags 2.10.0", + "block", + "core-graphics-types", + "foreign-types", + "log", + "objc", + "paste", +] + +[[package]] +name = "no_std_strings" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5b0c77c1b780822bc749a33e39aeb2c07584ab93332303babeabb645298a76e" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_enum" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1207a7e20ad57b847bbddc6776b968420d38292bbfe2089accff5e19e82454c" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff32365de1b6743cb203b710788263c44a03de03802daf96092f2da4fe6ba4d7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "postcard" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6764c3b5dd454e283a30e6dfe78e9b31096d9e32036b5d1eaac7a6119ccb9a24" +dependencies = [ + "cobs", + "embedded-io 0.4.0", + "embedded-io 0.6.1", + "serde", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro-crate" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "219cb19e96be00ab2e37d6e299658a0cfa83e52429179969b0f0121b4ac46983" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bee689443a2bd0a16ab0348b52ee43e3b2d1b1f931c8aa5c9f8de4c86fbe8c40" +dependencies = [ + "bitflags 2.10.0", + "num-traits", + "rand 0.9.2", + "rand_chacha 0.9.0", + "rand_xorshift", + "unarray", +] + +[[package]] +name = "quote" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.5", +] + +[[package]] +name = "risc0-binfmt" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dca096030bb4c52f99b12abcfe3531ea93b17b95a12a5aeb06fbf8ee588a275" +dependencies = [ + "anyhow", + "borsh", + "bytemuck", + "derive_more", + "elf", + "lazy_static", + "postcard", + "rand 0.9.2", + "risc0-zkp", + "risc0-zkvm-platform", + "ruint", + "semver", + "serde", + "tracing", +] + +[[package]] +name = "risc0-circuit-keccak" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e1d23ef3648bb85b0bd37bc9f9f7d13f1a4388e5e779e18f7eea82b969e5dbc" +dependencies = [ + "anyhow", + "bytemuck", + "paste", + "risc0-binfmt", + "risc0-circuit-recursion", + "risc0-core", + "risc0-zkp", + "tracing", +] + +[[package]] +name = "risc0-circuit-recursion" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "028cd26e1b1f7bdd964d2f1eac8f812d1872b6b8fd24f10804f07d916b90000e" +dependencies = [ + "anyhow", + "bytemuck", + "hex", + "metal", + "risc0-core", + "risc0-zkp", + "tracing", +] + +[[package]] +name = "risc0-circuit-rv32im" +version = "4.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ecd73a71ddce62eab8a28552ee182dc2ea08cdce2a3474a616a80bf2d6e9be" +dependencies = [ + "anyhow", + "bit-vec", + "bytemuck", + "derive_more", + "paste", + "risc0-binfmt", + "risc0-core", + "risc0-zkp", + "serde", + "tracing", +] + +[[package]] +name = "risc0-core" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80f2723fedace48c6c5a505bd8f97ac4e1712bc4cb769083e10536d862b66987" +dependencies = [ + "bytemuck", + "rand_core 0.9.5", +] + +[[package]] +name = "risc0-groth16" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ff13f9b427254c5264e01aaa32e33f355525299b6829449295905778f3b1e8" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-ff", + "ark-groth16", + "ark-serialize", + "bytemuck", + "hex", + "num-bigint", + "num-traits", + "risc0-binfmt", + "risc0-zkp", + "serde", +] + +[[package]] +name = "risc0-zkos-v1compat" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf1f35f2ef61d8d86fdd06288c11d2f3bbf08f1af66b24ca0a1976ecbf324a1" +dependencies = [ + "include_bytes_aligned", + "no_std_strings", + "risc0-zkvm-platform", +] + +[[package]] +name = "risc0-zkp" +version = "3.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "beb493b3f007f04a11106a001c66bca77338d0fc375766189fd7ca3a1e8c3700" +dependencies = [ + "anyhow", + "blake2", + "borsh", + "bytemuck", + "cfg-if", + "digest", + "hex", + "hex-literal", + "metal", + "paste", + "rand_core 0.9.5", + "risc0-core", + "risc0-zkvm-platform", + "serde", + "sha2", + "stability", + "tracing", +] + +[[package]] +name = "risc0-zkvm" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39d9943fe71decea1e8b6a99480cefa33799ab08b5abfccd7e2a18fb07121c1" +dependencies = [ + "anyhow", + "borsh", + "bytemuck", + "derive_more", + "hex", + "risc0-binfmt", + "risc0-circuit-keccak", + "risc0-circuit-recursion", + "risc0-circuit-rv32im", + "risc0-core", + "risc0-groth16", + "risc0-zkos-v1compat", + "risc0-zkp", + "risc0-zkvm-platform", + "rrs-lib", + "semver", + "serde", + "sha2", + "stability", + "tracing", +] + +[[package]] +name = "risc0-zkvm-platform" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfaa10feba15828c788837ddde84b994393936d8f5715228627cfe8625122a40" +dependencies = [ + "bytemuck", + "cfg-if", + "getrandom 0.2.17", + "getrandom 0.3.4", + "libm", + "num_enum", + "paste", + "stability", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] + +[[package]] +name = "ruint" +version = "1.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c141e807189ad38a07276942c6623032d3753c8859c146104ac2e4d68865945a" +dependencies = [ + "borsh", + "proptest", + "rand 0.8.5", + "rand 0.9.2", + "ruint-macro", + "serde_core", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn 2.0.114", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "toml_datetime" +version = "0.7.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92e1cfed4a3038bc5a127e35a2d360f145e1f4b971b551a2ba5fd7aedf7e1347" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.23.10+spec-1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84c8b9f757e028cee9fa244aea147aab2a9ec09d5325a9b01e0a49730c2b5269" +dependencies = [ + "indexmap", + "toml_datetime", + "toml_parser", + "winnow", +] + +[[package]] +name = "toml_parser" +version = "1.0.6+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3198b4b0a8e11f09dd03e133c0280504d0801269e9afa46362ffde1cbeebf44" +dependencies = [ + "winnow", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "zerocopy" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668f5168d10b9ee831de31933dc111a459c97ec93225beb307aed970d1372dfd" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c7962b26b0a8685668b671ee4b54d007a67d4eaf05fda79ac0ecf41e32270f1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85a5b4158499876c763cb03bc4e49185d3cccbabb15b33c627f7884f43db852e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.114", +] + +[[package]] +name = "zkvm-guest" +version = "0.1.0" +dependencies = [ + "kernel-guest", + "risc0-zkvm", +] diff --git a/crates/methods/zkvm-guest/Cargo.toml b/crates/methods/zkvm-guest/Cargo.toml new file mode 100644 index 0000000..4f06828 --- /dev/null +++ b/crates/methods/zkvm-guest/Cargo.toml @@ -0,0 +1,27 @@ +# RISC Zero Guest Wrapper for kernel-guest +# +# This is a minimal wrapper crate that allows risc0-build to compile +# kernel-guest as a zkVM guest program. It provides the main() entry point +# that delegates to the kernel-guest library. + +[package] +name = "zkvm-guest" +version = "0.1.0" +edition = "2021" + +# Required for risc0-build to recognize this as a standalone guest +[workspace] + +[dependencies] +# The actual kernel-guest library with all its dependencies +kernel-guest = { path = "../../kernel-guest", default-features = true } + +# RISC Zero zkVM guest runtime +risc0-zkvm = { version = "3.0", default-features = false, features = ["std"] } + +[features] +default = [] + +[profile.release] +debug = 1 +lto = true diff --git a/crates/methods/zkvm-guest/src/main.rs b/crates/methods/zkvm-guest/src/main.rs new file mode 100644 index 0000000..7dafda6 --- /dev/null +++ b/crates/methods/zkvm-guest/src/main.rs @@ -0,0 +1,33 @@ +//! RISC Zero zkVM Guest Entry Point +//! +//! This is a wrapper that delegates to the kernel-guest library for zkVM execution. +//! +//! # Execution Flow +//! +//! 1. Read `KernelInputV1` bytes from the host via `env::read()` +//! 2. Execute `kernel_main()` which runs the agent and enforces constraints +//! 3. Commit the `KernelJournalV1` bytes to the journal via `env::commit_slice()` +//! +//! # Error Handling +//! +//! If kernel execution fails (e.g., version mismatch, agent code hash mismatch), +//! the guest panics. This aborts proof generation - no valid receipt is produced. + +fn main() { + use risc0_zkvm::guest::env; + + // Read input bytes from the host + let input_bytes: Vec = env::read(); + + // Execute kernel (agent execution + constraint enforcement) + match kernel_guest::kernel_main(&input_bytes) { + Ok(journal_bytes) => { + // Commit journal to the proof receipt + env::commit_slice(&journal_bytes); + } + Err(error) => { + // Panic aborts proof generation - this is intentional + panic!("Kernel execution failed: {:?}", error); + } + } +} diff --git a/spec/e2e-tests.md b/spec/e2e-tests.md new file mode 100644 index 0000000..2352172 --- /dev/null +++ b/spec/e2e-tests.md @@ -0,0 +1,414 @@ +# End-to-End zkVM Proof Tests Specification + +**Version:** 0.1.0 +**Status:** Canonical +**Crates:** `methods`, `e2e-tests` + +--- + +## 1. Overview + +The E2E testing framework validates the complete execution kernel pipeline from agent execution through zkVM proof generation to on-chain verification data extraction. + +### 1.1 Purpose + +Verify that: +1. The kernel executes correctly inside RISC Zero zkVM +2. Proofs are generated and verifiable against `IMAGE_ID` +3. Journal contents match expected values +4. Security properties (agent code hash binding) are enforced +5. On-chain verification data (seal, journal, imageId) is extractable + +### 1.2 Architecture + +``` +┌─────────────────────────────────────────────────────────────────────────┐ +│ E2E Test Pipeline │ +├─────────────────────────────────────────────────────────────────────────┤ +│ │ +│ 1. Input Construction │ +│ ┌──────────────────┐ │ +│ │ KernelInputV1 │ ← agent_code_hash = │ +│ │ + opaque_inputs │ example_agent::AGENT_CODE_HASH │ +│ └────────┬─────────┘ │ +│ │ encode() │ +│ ▼ │ +│ 2. zkVM Execution │ +│ ┌──────────────────┐ ┌─────────────────────────────────────┐ │ +│ │ ExecutorEnv │────▶│ zkvm-guest (RISC-V ELF) │ │ +│ │ .write(&bytes) │ │ └─► kernel_guest::kernel_main() │ │ +│ └──────────────────┘ │ └─► agent_main() [linked] │ │ +│ └────────────────┬────────────────────┘ │ +│ │ env::commit_slice() │ +│ ▼ │ +│ 3. Proof Generation │ +│ ┌──────────────────┐ │ +│ │ ProveInfo │ │ +│ │ ├─ receipt │ ← Groth16Receipt with seal │ +│ │ └─ stats │ │ +│ └────────┬─────────┘ │ +│ │ │ +│ ▼ │ +│ 4. Verification │ +│ ┌──────────────────┐ │ +│ │ receipt.verify() │ ← Against ZKVM_GUEST_ID │ +│ └────────┬─────────┘ │ +│ │ │ +│ ▼ │ +│ 5. Journal Extraction │ +│ ┌──────────────────┐ │ +│ │ KernelJournalV1 │ ← Decode from receipt.journal.bytes │ +│ │ ├─ status │ │ +│ │ ├─ commitments │ │ +│ │ └─ identity │ │ +│ └──────────────────┘ │ +│ │ +│ 6. On-Chain Data │ +│ ┌──────────────────┐ │ +│ │ seal (256 bytes) │ ← Groth16 proof for Solidity verifier │ +│ │ journal (bytes) │ ← Public outputs │ +│ │ imageId (bytes32)│ ← Guest program identity │ +│ └──────────────────┘ │ +│ │ +└─────────────────────────────────────────────────────────────────────────┘ +``` + +--- + +## 2. Crate Structure + +### 2.1 methods Crate + +**Purpose:** Build the zkVM guest and export ELF/IMAGE_ID constants. + +``` +crates/methods/ +├── Cargo.toml # risc0-build dependency +├── build.rs # Invokes risc0_build::embed_methods() +├── src/ +│ └── lib.rs # include!(methods.rs) → exports ZKVM_GUEST_* +└── zkvm-guest/ # Standalone guest wrapper + ├── Cargo.toml # [workspace] + kernel-guest dependency + └── src/ + └── main.rs # Entry point calling kernel_guest::kernel_main() +``` + +#### 2.1.1 Exports + +| Constant | Type | Description | +|----------|------|-------------| +| `ZKVM_GUEST_ELF` | `&[u8]` | Compiled RISC-V ELF binary | +| `ZKVM_GUEST_ID` | `[u32; 8]` | IMAGE_ID (cryptographic identity) | + +#### 2.1.2 zkvm-guest Wrapper + +The wrapper is necessary because: +1. `risc0-build` expects guest crates as subdirectories +2. `kernel-guest` is a workspace member with complex dependencies +3. A standalone `[workspace]` declaration avoids lockfile conflicts + +```rust +// zkvm-guest/src/main.rs +fn main() { + use risc0_zkvm::guest::env; + + let input_bytes: Vec = env::read(); + + match kernel_guest::kernel_main(&input_bytes) { + Ok(journal_bytes) => env::commit_slice(&journal_bytes), + Err(error) => panic!("Kernel execution failed: {:?}", error), + } +} +``` + +### 2.2 e2e-tests Crate + +**Purpose:** Host-side integration tests with zkVM proof generation. + +``` +crates/e2e-tests/ +├── Cargo.toml # Feature-gated risc0-zkvm dependency +├── src/ +│ └── lib.rs # Test implementations +└── README.md # Usage documentation +``` + +#### 2.2.1 Feature Gates + +| Feature | Dependencies | Purpose | +|---------|--------------|---------| +| `default` | None | Unit tests only | +| `risc0-e2e` | `methods`, `risc0-zkvm/prove` | Full zkVM proof tests | + +--- + +## 3. Test Cases + +### 3.1 test_e2e_success_with_echo + +**Purpose:** Verify the happy path with valid input and echo action. + +**Input:** +- `opaque_inputs[0] == 1` (triggers echo) +- `agent_code_hash == example_agent::AGENT_CODE_HASH` + +**Expected:** +- Proof generation succeeds +- `receipt.verify(ZKVM_GUEST_ID)` passes +- `journal.execution_status == Success` +- `journal.input_commitment == SHA256(input_bytes)` +- `journal.action_commitment == SHA256(echo_output_bytes)` + +### 3.2 test_e2e_agent_code_hash_mismatch + +**Purpose:** Verify security - wrong agent code hash aborts execution. + +**Input:** +- `agent_code_hash == [0x00; 32]` (wrong hash) + +**Expected:** +- Guest panics with `AgentCodeHashMismatch` +- No valid proof/receipt produced +- `prover.prove()` returns error + +### 3.3 test_e2e_empty_output + +**Purpose:** Verify empty output handling. + +**Input:** +- `opaque_inputs[0] != 1` (no echo trigger) + +**Expected:** +- Proof generation succeeds +- `journal.execution_status == Success` +- `journal.action_commitment == EMPTY_OUTPUT_COMMITMENT` + +### 3.4 test_e2e_determinism + +**Purpose:** Verify deterministic execution. + +**Method:** +- Run same input twice +- Compare journal bytes + +**Expected:** +- `journals[0] == journals[1]` + +--- + +## 4. On-Chain Verification Data + +### 4.1 Data Structure + +For Solidity verifier integration, extract: + +| Field | Source | Format | +|-------|--------|--------| +| `seal` | `receipt.inner.Groth16.seal` | `bytes` (256 bytes) | +| `journal` | `receipt.journal.bytes` | `bytes` (variable) | +| `imageId` | `ZKVM_GUEST_ID` | `bytes32` (little-endian) | + +### 4.2 imageId Conversion + +```rust +// Convert [u32; 8] to bytes32 (little-endian) +let image_id_bytes: Vec = ZKVM_GUEST_ID + .iter() + .flat_map(|x| x.to_le_bytes()) + .collect(); +``` + +### 4.3 Solidity Verifier Interface + +```solidity +interface IRiscZeroVerifier { + function verify( + bytes calldata seal, + bytes32 imageId, + bytes32 journalDigest // or bytes calldata journal + ) external view; +} +``` + +--- + +## 5. IMAGE_ID Immutability + +### 5.1 What Changes IMAGE_ID + +| Change | IMAGE_ID Changes? | +|--------|-------------------| +| Agent code modification | Yes | +| Kernel logic modification | Yes | +| Compiler version change | Yes | +| Dependency version change | Possibly | +| Input data change | No | + +### 5.2 Per-Agent Deployment + +Each agent deployment produces a unique `IMAGE_ID`: + +``` +Agent A → zkvm-guest + kernel-guest + agent-a → IMAGE_ID_A +Agent B → zkvm-guest + kernel-guest + agent-b → IMAGE_ID_B +``` + +### 5.3 Reproducible Builds + +For deterministic `IMAGE_ID` across environments: + +```bash +RISC0_USE_DOCKER=1 cargo build -p methods +``` + +--- + +## 6. CI Integration + +### 6.1 Without RISC Zero + +```yaml +# Unit tests always work +- name: Run unit tests + run: cargo test -p e2e-tests +``` + +### 6.2 With RISC Zero + +```yaml +# E2E tests require RISC Zero toolchain +- name: Install RISC Zero + run: | + cargo install cargo-risczero + cargo risczero install + +- name: Run E2E proof tests + run: cargo test -p e2e-tests --features risc0-e2e -- --test-threads=1 +``` + +**Note:** Use `--test-threads=1` to avoid parallel proof generation exhausting memory. + +--- + +## 7. Helper Functions + +### 7.1 make_valid_input + +```rust +pub fn make_valid_input(opaque_agent_inputs: Vec) -> KernelInputV1 { + KernelInputV1 { + protocol_version: PROTOCOL_VERSION, + kernel_version: KERNEL_VERSION, + agent_id: [0x42; 32], + agent_code_hash: example_agent::AGENT_CODE_HASH, + constraint_set_hash: [0xbb; 32], + input_root: [0xcc; 32], + execution_nonce: 1, + opaque_agent_inputs, + } +} +``` + +### 7.2 make_input_with_wrong_hash + +```rust +pub fn make_input_with_wrong_hash(opaque_agent_inputs: Vec) -> KernelInputV1 { + KernelInputV1 { + agent_code_hash: [0x00; 32], // Wrong hash + // ... rest same as make_valid_input + } +} +``` + +### 7.3 compute_echo_commitment + +```rust +pub fn compute_echo_commitment(agent_id: [u8; 32], payload: &[u8]) -> [u8; 32] { + let action = ActionV1 { + action_type: ACTION_TYPE_ECHO, + target: agent_id, + payload: payload[..min(payload.len(), MAX_ACTION_PAYLOAD_BYTES)].to_vec(), + }; + let output = AgentOutput { actions: vec![action] }; + compute_action_commitment(&output.encode().unwrap()) +} +``` + +--- + +## 8. Error Handling + +### 8.1 Guest Panic Behavior + +| Error | Guest Behavior | Host Result | +|-------|----------------|-------------| +| `AgentCodeHashMismatch` | `panic!()` | Proof fails | +| `Codec(...)` | `panic!()` | Proof fails | +| `VersionMismatch` | `panic!()` | Proof fails | +| Constraint violation | Return failure journal | Proof succeeds | + +### 8.2 Resource Exhaustion + +Parallel proof generation may cause OOM (exit code 137). Mitigations: +- Run tests sequentially: `--test-threads=1` +- Increase Docker memory limits +- Run tests individually + +--- + +## 9. Dependencies + +### 9.1 methods Crate + +```toml +[build-dependencies] +risc0-build = { version = "3.0", default-features = false } + +[package.metadata.risc0] +methods = ["zkvm-guest"] +``` + +### 9.2 e2e-tests Crate + +```toml +[dependencies] +kernel-core = { path = "../kernel-core" } +kernel-sdk = { path = "../kernel-sdk" } +constraints = { path = "../constraints" } +example-agent = { path = "../example-agent" } +methods = { path = "../methods", optional = true } +risc0-zkvm = { version = "3.0", default-features = false, optional = true } + +[dev-dependencies] +hex = "0.4" + +[features] +risc0-e2e = ["dep:methods", "dep:risc0-zkvm", "risc0-zkvm/prove"] +``` + +--- + +## Appendix A: Example Test Output + +``` +=== On-chain verification data === +seal (hex): 0x00892d14f88aca6a... +seal length: 256 bytes +journal (hex): 0x01000000010000004242... +journal length: 209 bytes +image_id (bytes32): 0xb326f06dbfc60f5e72d2d7cddf94f7991cff99dfd67f69357713bb9f49c3d195 +image_id (u32[8]): [1844455091, 1578092223, 3453473394, 2583139551, 3751411484, 896106454, 2679837559, 2513552201] +``` + +--- + +## Appendix B: Proof Generation Time + +| Test | Approximate Time | +|------|------------------| +| `test_e2e_success_with_echo` | ~100s | +| `test_e2e_agent_code_hash_mismatch` | <1s (no proof) | +| `test_e2e_empty_output` | ~100s | +| `test_e2e_determinism` | ~200s (2 proofs) | + +Times vary based on hardware and Docker configuration.