move new out of zkvm-interface

This commit is contained in:
Kevaundray Wedderburn
2025-05-20 00:30:48 +01:00
parent 36fa788dd3
commit ea6600f932
5 changed files with 20 additions and 17 deletions

View File

@@ -44,15 +44,16 @@ pub struct EreJolt {
program: <JOLT_TARGET as Compiler>::Program,
}
impl zkVM<JOLT_TARGET> for EreJolt {
type Error = JoltError;
impl EreJolt {
fn new(
program: <JOLT_TARGET as Compiler>::Program,
_resource_type: ProverResourceType,
) -> Self {
EreJolt { program: program }
}
}
impl zkVM for EreJolt {
type Error = JoltError;
fn execute(
&self,

View File

@@ -47,15 +47,16 @@ pub struct EreOpenVM {
program: <OPENVM_TARGET as Compiler>::Program,
}
impl zkVM<OPENVM_TARGET> for EreOpenVM {
type Error = OpenVMError;
impl EreOpenVM {
fn new(
program: <OPENVM_TARGET as Compiler>::Program,
_resource_type: ProverResourceType,
) -> Self {
Self { program }
}
}
impl zkVM for EreOpenVM {
type Error = OpenVMError;
fn execute(
&self,

View File

@@ -51,10 +51,8 @@ pub struct ErePico {
program: <PICO_TARGET as Compiler>::Program,
}
impl zkVM<PICO_TARGET> for ErePico {
type Error = PicoError;
fn new(
impl ErePico {
pub fn new(
program_bytes: <PICO_TARGET as Compiler>::Program,
_resource_type: ProverResourceType,
) -> Self {
@@ -62,6 +60,9 @@ impl zkVM<PICO_TARGET> for ErePico {
program: program_bytes,
}
}
}
impl zkVM for ErePico {
type Error = PicoError;
fn execute(
&self,

View File

@@ -92,10 +92,8 @@ impl Compiler for RV32_IM_SUCCINCT_ZKVM_ELF {
}
}
impl zkVM<RV32_IM_SUCCINCT_ZKVM_ELF> for EreSP1 {
type Error = SP1Error;
fn new(
impl EreSP1 {
pub fn new(
program: <RV32_IM_SUCCINCT_ZKVM_ELF as Compiler>::Program,
resource: ProverResourceType,
) -> Self {
@@ -112,6 +110,10 @@ impl zkVM<RV32_IM_SUCCINCT_ZKVM_ELF> for EreSP1 {
vk,
}
}
}
impl zkVM for EreSP1 {
type Error = SP1Error;
fn execute(
&self,

View File

@@ -25,11 +25,9 @@ pub enum ProverResourceType {
#[allow(non_camel_case_types)]
/// zkVM trait to abstract away the differences between each zkVM
pub trait zkVM<C: Compiler> {
pub trait zkVM {
type Error: std::error::Error + Send + Sync + 'static;
fn new(program_bytes: C::Program, resource: ProverResourceType) -> Self;
/// Executes the given program with the inputs accumulated in the Input struct.
/// For RISCV programs, `program_bytes` will be the ELF binary
fn execute(&self, inputs: &Input) -> Result<ProgramExecutionReport, Self::Error>;