v0.1.0-pre.015

This commit is contained in:
2026-07-24 17:25:51 +02:00
parent 60a75c4434
commit a818c4a60e
26 changed files with 16723 additions and 103 deletions

View File

@@ -1,5 +1,5 @@
// file: kb-lib/tests/external_executor_api.rs
// version: 2
// version: 3
//! Downstream-style compilation contract for externally implemented executors.
@@ -92,4 +92,29 @@ fn external_executor_uses_only_the_public_kb_lib_contract() {
assert!(plan.required_signers.is_empty());
assert_eq!(plan.policy.simulation, kb_lib::ExApiExecutionSimulationPolicy::Required);
assert!(plan.policy.dry_run);
let solana_core_executor = kb_lib::ExSolanaCoreExecutor;
let solana_core_program_id =
kb_lib::MdProgramId(kb_program_ids::COMPUTE_BUDGET_PROGRAM_ID.to_string());
let solana_core_capability = kb_lib::ExApiTypedInstructionExecutor::capability(
&solana_core_executor,
&solana_core_program_id,
kb_lib::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION,
);
assert!(solana_core_capability.is_supported());
let solana_core_intent = kb_lib::ExSolanaCoreExecutionIntent {
intent_id: "external-solana-core".to_string(),
fee_payer: kb_lib::MdPubkey(kb_program_ids::SYSTEM_PROGRAM_ID.to_string()),
policy: kb_lib::ExApiExecutionPolicy::default(),
operation: kb_lib::ExSolanaCoreOperation::ComputeBudgetSetUnitLimit { units: 500_000 },
};
let solana_core_plan = kb_lib::ExApiTypedInstructionExecutor::build_prepared_plan(
&solana_core_executor,
&solana_core_intent,
)
.unwrap_or_else(|error| panic!("Solana core executor failed: {error}"));
assert_eq!(solana_core_plan.instructions.len(), 1);
assert_eq!(
solana_core_plan.operation_code,
kb_lib::EX_SOLANA_CORE_COMPUTE_BUDGET_SET_UNIT_LIMIT_OPERATION
);
}