-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [zkos] compute and return the witness (#545)
* ugly hacks to return the witness * compute witness correctly * passing zkconfig along * moved zkos into zkos_config * moved zkos namespace to proper place * added docs * put dependency back on main branch
- Loading branch information
Showing
21 changed files
with
1,030 additions
and
530 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use jsonrpsee::core::RpcResult; | ||
use jsonrpsee::proc_macros::rpc; | ||
|
||
/// API bindings for the `zkos` experimental namespace. | ||
#[rpc(server, namespace = "zkos")] | ||
pub trait ZKOSNamespace { | ||
/// Returns the witness for a given batch. | ||
/// | ||
/// # Returns | ||
/// Bytes with the witness that can be passed to proving system. | ||
#[method(name = "getWitness")] | ||
async fn get_witness(&self, batch: u32) -> RpcResult<Option<Vec<u8>>>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use anvil_zksync_core::node::zkos_get_batch_witness; | ||
use jsonrpsee::core::{async_trait, RpcResult}; | ||
|
||
use anvil_zksync_api_decl::ZKOSNamespaceServer; | ||
|
||
pub struct ZKOSNamespace {} | ||
|
||
impl ZKOSNamespace { | ||
pub fn new() -> Self { | ||
Self {} | ||
} | ||
} | ||
|
||
#[async_trait] | ||
impl ZKOSNamespaceServer for ZKOSNamespace { | ||
async fn get_witness(&self, batch: u32) -> RpcResult<Option<Vec<u8>>> { | ||
Ok(zkos_get_batch_witness(&batch)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
use clap::Parser; | ||
use serde::Deserialize; | ||
|
||
/// Genesis | ||
#[derive(Deserialize, Clone, Debug, Parser, Default)] | ||
pub struct ZKOSConfig { | ||
#[arg(long, help_heading = "Experimental Configuration")] | ||
/// Enables zkos (experimental). | ||
pub use_zkos: bool, | ||
|
||
#[arg(long, help_heading = "Experimental Configuration")] | ||
/// Path to zkos binary (if you need to compute witnesses). | ||
pub zkos_bin_path: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.