Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ prism-prover = { workspace = true }
prism-lightclient = { workspace = true }
prism-da = { workspace = true }
prism-keys = { workspace = true }
prism-serde = { workspace = true }
25 changes: 13 additions & 12 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use std::io::{Error, ErrorKind};
use node_types::NodeType;
use prism_lightclient::LightClient;
use prism_prover::Prover;
use prism_serde::base64::{FromBase64, ToBase64};
use prism_storage::RedisConnection;
use std::{str::FromStr, sync::Arc};

Expand All @@ -36,18 +37,18 @@ async fn main() -> std::io::Result<()> {
Error::new(ErrorKind::NotFound, "celestia configuration not found")
})?;

let verifying_key_algorithm =
let _verifying_key_algorithm =
CryptoAlgorithm::from_str(&config.verifying_key_algorithm).map_err(|_| {
Error::new(
ErrorKind::InvalidInput,
"invalid verifying key algorithm format",
)
})?;
Comment on lines +40 to 46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove the underscore prefix from _verifying_key_algorithm.

The variable is marked as unused with an underscore prefix, but it's actually used in the code. This is misleading.

-            let _verifying_key_algorithm =
+            let verifying_key_algorithm =
                 CryptoAlgorithm::from_str(&config.verifying_key_algorithm).map_err(|_| {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
let _verifying_key_algorithm =
CryptoAlgorithm::from_str(&config.verifying_key_algorithm).map_err(|_| {
Error::new(
ErrorKind::InvalidInput,
"invalid verifying key algorithm format",
)
})?;
let verifying_key_algorithm =
CryptoAlgorithm::from_str(&config.verifying_key_algorithm).map_err(|_| {
Error::new(
ErrorKind::InvalidInput,
"invalid verifying key algorithm format",
)
})?;

let prover_vk = VerifyingKey::from_algorithm_and_bytes(
verifying_key_algorithm,
config.verifying_key.unwrap().as_bytes(),
)
.map_err(|e| Error::new(ErrorKind::InvalidInput, e.to_string()))?;
let verifying_key_base64 = config
.verifying_key
.ok_or_else(|| Error::new(ErrorKind::InvalidInput, "verifying key not found"))?;
let prover_vk = VerifyingKey::from_base64(verifying_key_base64)
.map_err(|e: anyhow::Error| Error::new(ErrorKind::InvalidInput, e.to_string()))?;

let client = ProverClient::mock();
let (_, vk) = client.setup(PRISM_ELF);
Expand Down Expand Up @@ -97,6 +98,8 @@ async fn main() -> std::io::Result<()> {
})?;
let verifying_key = signing_key.verifying_key();

info!("verifying key: {}", verifying_key.to_base64());

let prover_cfg = prism_prover::Config {
prover: true,
batcher: true,
Expand Down Expand Up @@ -152,13 +155,11 @@ async fn main() -> std::io::Result<()> {
)
})?;

let prover_vk = config
let verifying_key_base64 = config
.verifying_key
.ok_or_else(|| Error::new(ErrorKind::NotFound, "prover verifying key not found"))
.and_then(|vk| {
VerifyingKey::from_algorithm_and_bytes(verifying_key_algorithm, vk.as_bytes())
.map_err(|e| Error::new(ErrorKind::InvalidInput, e.to_string()))
})?;
.ok_or_else(|| Error::new(ErrorKind::InvalidInput, "verifying key not found"))?;
let prover_vk = VerifyingKey::from_base64(verifying_key_base64)
.map_err(|e: anyhow::Error| Error::new(ErrorKind::InvalidInput, e.to_string()))?;

let prover_cfg = prism_prover::Config {
prover: false,
Expand Down
6 changes: 6 additions & 0 deletions crates/keys/src/verifying_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,12 @@ impl TryFrom<String> for VerifyingKey {
}
}

impl ToBase64 for VerifyingKey {
fn to_base64(&self) -> String {
self.to_bytes().to_base64()
}
}

impl std::fmt::Display for VerifyingKey {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
let encoded = self.to_bytes().to_base64();
Expand Down
Binary file modified elf/riscv32im-succinct-zkvm-elf
Binary file not shown.
Loading