forked from matter-labs/zksync-era
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(commitment-generator): Commitment for 1.4.2 (matter-labs#1234)
## What ❔ Adds support for 1.4.2 commitment (blob hashes are taken into account) ## 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`. - [ ] Spellcheck has been run via `zk spellcheck`. - [ ] Linkcheck has been run via `zk linkcheck`.
- Loading branch information
1 parent
f6bff74
commit 9b773eb
Showing
33 changed files
with
1,155 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -905,3 +905,4 @@ shivini | |
balancer | ||
lookups | ||
stateful | ||
WIP |
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 serde::Deserialize; | ||
|
||
#[derive(Debug, Deserialize, Clone, PartialEq)] | ||
pub struct KzgConfig { | ||
/// Path to KZG trusted setup file. | ||
#[serde(default = "KzgConfig::default_trusted_setup_path")] | ||
pub trusted_setup_path: String, | ||
} | ||
|
||
impl KzgConfig { | ||
fn default_trusted_setup_path() -> String { | ||
"./trusted_setup.json".to_owned() | ||
} | ||
} |
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,35 @@ | ||
use zksync_config::configs::KzgConfig; | ||
|
||
use crate::{envy_load, FromEnv}; | ||
|
||
impl FromEnv for KzgConfig { | ||
fn from_env() -> anyhow::Result<Self> { | ||
envy_load("kzg", "KZG_") | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
use crate::test_utils::EnvMutex; | ||
|
||
static MUTEX: EnvMutex = EnvMutex::new(); | ||
|
||
fn expected_config() -> KzgConfig { | ||
KzgConfig { | ||
trusted_setup_path: "dir/file.json".to_owned(), | ||
} | ||
} | ||
|
||
#[test] | ||
fn from_env() { | ||
let mut lock = MUTEX.lock(); | ||
let config = r#" | ||
KZG_TRUSTED_SETUP_PATH="dir/file.json" | ||
"#; | ||
lock.set_env(config); | ||
|
||
let actual = KzgConfig::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
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 |
---|---|---|
@@ -1 +1 @@ | ||
mod kzg; | ||
pub mod kzg; |
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
//! Different interfaces exposed by the `IExecutor.sol`. | ||
mod commit; | ||
|
||
pub mod commit; | ||
pub mod methods; | ||
pub mod structures; |
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,22 @@ | ||
use anyhow::Context as _; | ||
use zksync_config::configs; | ||
use zksync_protobuf::required; | ||
|
||
use crate::{proto, repr::ProtoRepr}; | ||
|
||
impl ProtoRepr for proto::Kzg { | ||
type Type = configs::KzgConfig; | ||
fn read(&self) -> anyhow::Result<Self::Type> { | ||
Ok(Self::Type { | ||
trusted_setup_path: required(&self.trusted_setup_path) | ||
.context("trusted_setup_path")? | ||
.clone(), | ||
}) | ||
} | ||
|
||
fn build(this: &Self::Type) -> Self { | ||
Self { | ||
trusted_setup_path: Some(this.trusted_setup_path.clone()), | ||
} | ||
} | ||
} |
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,7 @@ | ||
syntax = "proto3"; | ||
|
||
package zksync.config; | ||
|
||
message Kzg { | ||
optional string trusted_setup_path = 1; // required; fs path | ||
} |
Oops, something went wrong.