Skip to content

Commit ffe698c

Browse files
committed
bytecode: add program struct
1 parent 9ff96c8 commit ffe698c

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

crates/leanVm/src/bytecode/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ pub mod hint;
77
pub mod instruction;
88
pub mod operand;
99
pub mod operation;
10+
pub mod program;
1011

1112
/// Represents the compiled bytecode of a program for the zkVM.
12-
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
13+
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
1314
pub struct Bytecode {
1415
/// A vector of instructions that form the executable part of the program.
1516
///
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
use super::Bytecode;
2+
use crate::constant::F;
3+
4+
/// Represents a program to be executed by the zkVM.
5+
#[derive(Debug, Clone, Default)]
6+
pub struct Program {
7+
/// The compiled instructions and hints for the program.
8+
pub bytecode: Bytecode,
9+
/// The public inputs for this specific execution.
10+
pub public_input: Vec<F>,
11+
/// The private (witness) inputs for this specific execution.
12+
pub private_input: Vec<F>,
13+
}

crates/leanVm/src/core.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::{
66
instruction::Instruction,
77
operand::{MemOrConstant, MemOrFp, MemOrFpOrConstant},
88
operation::Operation,
9+
program::Program,
910
},
1011
constant::{DIMENSION, EF, F},
1112
context::run_context::RunContext,
@@ -19,13 +20,15 @@ pub struct VirtualMachine<PERM16, PERM24> {
1920
pub memory_manager: MemoryManager,
2021
pub poseidon2_16: PERM16,
2122
pub poseidon2_24: PERM24,
23+
pub(crate) program: Program,
2224
}
2325

2426
impl<PERM16, PERM24> VirtualMachine<PERM16, PERM24> {
2527
pub fn new(poseidon2_16: PERM16, poseidon2_24: PERM24) -> Self {
2628
Self {
2729
run_context: RunContext::default(),
2830
memory_manager: MemoryManager::default(),
31+
program: Program::default(),
2932
poseidon2_16,
3033
poseidon2_24,
3134
}

0 commit comments

Comments
 (0)