-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## What ❔ Adds prover API component, which allows to get proof generation data and verify final proofs against generated by our prover subsystem. ## Why ❔ First step of prover decentralization. ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. --------- Co-authored-by: EmilLuta <[email protected]>
- Loading branch information
1 parent
e23e661
commit 129a181
Showing
30 changed files
with
712 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
6 changes: 6 additions & 0 deletions
6
core/lib/config/src/configs/external_proof_integration_api.rs
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,6 @@ | ||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Deserialize, Clone, PartialEq)] | ||
pub struct ExternalProofIntegrationApiConfig { | ||
pub http_port: u16, | ||
} |
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
20 changes: 20 additions & 0 deletions
20
...lib/dal/.sqlx/query-782726c01284ded3905c312262afd52908e6748be50524871ff40e3301fecab1.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use zksync_config::configs::ExternalProofIntegrationApiConfig; | ||
|
||
use crate::{envy_load, FromEnv}; | ||
|
||
impl FromEnv for ExternalProofIntegrationApiConfig { | ||
fn from_env() -> anyhow::Result<Self> { | ||
envy_load( | ||
"external_proof_integration_api", | ||
"EXTERNAL_PROOF_INTEGRATION_API_", | ||
) | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::test_utils::EnvMutex; | ||
|
||
static MUTEX: EnvMutex = EnvMutex::new(); | ||
|
||
fn expected_config() -> ExternalProofIntegrationApiConfig { | ||
ExternalProofIntegrationApiConfig { http_port: 3320 } | ||
} | ||
|
||
#[test] | ||
fn from_env() { | ||
let config = r#" | ||
EXTERNAL_PROOF_INTEGRATION_API_HTTP_PORT="3320" | ||
"#; | ||
let mut lock = MUTEX.lock(); | ||
lock.set_env(config); | ||
let actual = ExternalProofIntegrationApiConfig::from_env().unwrap(); | ||
assert_eq!(actual, expected_config()); | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
core/lib/protobuf_config/src/external_proof_integration_api.rs
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,22 @@ | ||
use anyhow::Context; | ||
use zksync_config::ExternalProofIntegrationApiConfig; | ||
use zksync_protobuf::{required, ProtoRepr}; | ||
|
||
use crate::proto::external_proof_integration_api as proto; | ||
|
||
impl ProtoRepr for proto::ExternalProofIntegrationApi { | ||
type Type = ExternalProofIntegrationApiConfig; | ||
fn read(&self) -> anyhow::Result<Self::Type> { | ||
Ok(Self::Type { | ||
http_port: required(&self.http_port) | ||
.and_then(|p| Ok((*p).try_into()?)) | ||
.context("http_port")?, | ||
}) | ||
} | ||
|
||
fn build(this: &Self::Type) -> Self { | ||
Self { | ||
http_port: Some(this.http_port.into()), | ||
} | ||
} | ||
} |
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
7 changes: 7 additions & 0 deletions
7
core/lib/protobuf_config/src/proto/config/external_proof_integration_api.proto
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,7 @@ | ||
syntax = "proto3"; | ||
|
||
package zksync.config.external_proof_integration_api; | ||
|
||
message ExternalProofIntegrationApi { | ||
optional uint32 http_port = 1; | ||
} |
Oops, something went wrong.