Skip to content

Commit

Permalink
feat: update sdkConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
arayikhalatyan committed Dec 13, 2024
1 parent 05d457d commit 18f598e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ openvm-ecc-circuit = { workspace = true }
openvm-ecc-transpiler = { workspace = true }
openvm-keccak256-circuit = { workspace = true }
openvm-keccak256-transpiler = { workspace = true }
openvm-sha256-circuit = { workspace = true }
openvm-sha256-transpiler = { workspace = true }
openvm-pairing-circuit = { workspace = true }
openvm-pairing-transpiler = { workspace = true }
openvm-native-circuit = { workspace = true }
Expand Down
19 changes: 19 additions & 0 deletions crates/sdk/src/config/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ use openvm_rv32im_circuit::{
use openvm_rv32im_transpiler::{
Rv32ITranspilerExtension, Rv32IoTranspilerExtension, Rv32MTranspilerExtension,
};
use openvm_sha256_circuit::{Sha256, Sha256Executor, Sha256Periphery};
use openvm_sha256_transpiler::Sha256TranspilerExtension;
use openvm_stark_backend::p3_field::PrimeField32;
use openvm_transpiler::transpiler::Transpiler;
use serde::{Deserialize, Serialize};
Expand All @@ -46,6 +48,7 @@ pub struct SdkVmConfig {
pub rv32i: Option<UnitStruct>,
pub io: Option<UnitStruct>,
pub keccak: Option<UnitStruct>,
pub sha256: Option<UnitStruct>,
pub native: Option<UnitStruct>,

pub rv32m: Option<Rv32M>,
Expand All @@ -67,6 +70,8 @@ pub enum SdkVmConfigExecutor<F: PrimeField32> {
#[any_enum]
Keccak(Keccak256Executor<F>),
#[any_enum]
Sha256(Sha256Executor<F>),
#[any_enum]
Native(NativeExecutor<F>),
#[any_enum]
Rv32m(Rv32MExecutor<F>),
Expand All @@ -93,6 +98,8 @@ pub enum SdkVmConfigPeriphery<F: PrimeField32> {
#[any_enum]
Keccak(Keccak256Periphery<F>),
#[any_enum]
Sha256(Sha256Periphery<F>),
#[any_enum]
Native(NativePeriphery<F>),
#[any_enum]
Rv32m(Rv32MPeriphery<F>),
Expand Down Expand Up @@ -120,6 +127,9 @@ impl SdkVmConfig {
if self.keccak.is_some() {
transpiler = transpiler.with_extension(Keccak256TranspilerExtension);
}
if self.sha256.is_some() {
transpiler = transpiler.with_extension(Sha256TranspilerExtension);
}
if self.rv32m.is_some() {
transpiler = transpiler.with_extension(Rv32MTranspilerExtension);
}
Expand Down Expand Up @@ -168,6 +178,9 @@ impl<F: PrimeField32> VmConfig<F> for SdkVmConfig {
if self.keccak.is_some() {
complex = complex.extend(&Keccak256)?;
}
if self.sha256.is_some() {
complex = complex.extend(&Sha256)?;
}
if self.native.is_some() {
complex = complex.extend(&Native)?;
}
Expand Down Expand Up @@ -251,6 +264,12 @@ impl From<Keccak256> for UnitStruct {
}
}

impl From<Sha256> for UnitStruct {
fn from(_: Sha256) -> Self {
UnitStruct {}
}
}

impl From<Native> for UnitStruct {
fn from(_: Native) -> Self {
UnitStruct {}
Expand Down

0 comments on commit 18f598e

Please sign in to comment.