Skip to content

Commit

Permalink
Move to common crate
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Sep 11, 2024
1 parent 6f20d15 commit 0b71dc0
Show file tree
Hide file tree
Showing 19 changed files with 43 additions and 100 deletions.
8 changes: 8 additions & 0 deletions Cargo.lock

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

19 changes: 18 additions & 1 deletion common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,24 @@ pub const EMPTY_TRIE_HASH: H256 = H256([
108, 173, 192, 1, 98, 47, 181, 227, 99, 180, 33,
]);

pub const NETWORK_ERR_MSG: &str = "One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected";
#[macro_export]
/// A convenience macro to check the feature flags activating chain specific
/// behaviors. Only one of these flags may be activated at a time.
macro_rules! check_chain_features {
() => {
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
};
}

#[test]
fn test_empty_code_hash() {
Expand Down
1 change: 1 addition & 0 deletions evm_arithmetization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ serde-big-array = { workspace = true }
# Local dependencies
mpt_trie = { workspace = true }
smt_trie = { workspace = true, optional = true }
zk_evm_common = { workspace = true }
zk_evm_proc_macro = { workspace = true }

[dev-dependencies]
Expand Down
12 changes: 1 addition & 11 deletions evm_arithmetization/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,7 @@
#![allow(clippy::field_reassign_with_default)]
#![feature(let_chains)]

#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

// Individual STARK processing units
pub mod arithmetic;
Expand Down
1 change: 1 addition & 0 deletions proof_gen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ hashbrown = { workspace = true }

# Local dependencies
evm_arithmetization = { workspace = true }
zk_evm_common = { workspace = true }

[features]
default = ["eth_mainnet"]
Expand Down
12 changes: 1 addition & 11 deletions proof_gen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,7 @@
//! assert!(verifier_state.verify(block_proof.intern).is_ok());
//! ```
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

pub(crate) mod constants;
pub mod proof_gen;
Expand Down
12 changes: 1 addition & 11 deletions trace_decoder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,17 +68,7 @@
#![warn(missing_debug_implementations)]
#![warn(missing_docs)]

#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

/// The broad overview is as follows:
///
Expand Down
1 change: 1 addition & 0 deletions zero_bin/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ directories = "5.0.1"
evm_arithmetization = { workspace = true }
proof_gen = { workspace = true }
trace_decoder = { workspace = true }
zk_evm_common = { workspace = true }

[build-dependencies]
cargo_metadata = { workspace = true }
Expand Down
12 changes: 1 addition & 11 deletions zero_bin/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();
pub mod block_interval;

pub mod debug_utils;
Expand Down
1 change: 1 addition & 0 deletions zero_bin/leader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ proof_gen = { workspace = true }
prover = { workspace = true }
rpc = { workspace = true }
zero_bin_common = { workspace = true }
zk_evm_common = { workspace = true }

[features]
default = ["eth_mainnet"]
Expand Down
12 changes: 1 addition & 11 deletions zero_bin/leader/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

use std::sync::Arc;
use std::{env, io};
Expand Down
1 change: 1 addition & 0 deletions zero_bin/ops/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ evm_arithmetization = { workspace = true }
proof_gen = { workspace = true }
trace_decoder = { workspace = true }
zero_bin_common = { workspace = true }
zk_evm_common = { workspace = true }

[features]
default = ["eth_mainnet"]
Expand Down
12 changes: 1 addition & 11 deletions zero_bin/ops/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

use std::time::Instant;

Expand Down
1 change: 1 addition & 0 deletions zero_bin/prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ evm_arithmetization = { workspace = true }
proof_gen = { workspace = true }
trace_decoder = { workspace = true }
zero_bin_common = { workspace = true }
zk_evm_common = { workspace = true }


[features]
Expand Down
12 changes: 1 addition & 11 deletions zero_bin/prover/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

pub mod cli;

Expand Down
1 change: 1 addition & 0 deletions zero_bin/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mpt_trie = { workspace = true }
prover = { workspace = true }
trace_decoder = { workspace = true }
zero_bin_common = { workspace = true }
zk_evm_common = { workspace = true }

[build-dependencies]
cargo_metadata = { workspace = true }
Expand Down
12 changes: 1 addition & 11 deletions zero_bin/rpc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

use std::sync::Arc;

Expand Down
1 change: 1 addition & 0 deletions zero_bin/verifier/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ serde_path_to_error = { workspace = true }
# Local dependencies
proof_gen = { workspace = true }
zero_bin_common = { workspace = true }
zk_evm_common = { workspace = true }

[build-dependencies]
cargo_metadata = { workspace = true }
Expand Down
12 changes: 1 addition & 11 deletions zero_bin/verifier/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
#[cfg(any(
all(feature = "cdk_erigon", feature = "polygon_pos"),
all(feature = "cdk_erigon", feature = "eth_mainnet"),
all(feature = "polygon_pos", feature = "eth_mainnet"),
not(any(
feature = "cdk_erigon",
feature = "eth_mainnet",
feature = "polygon_pos"
))
))]
compile_error!("One and only one of the feature chains `cdk_erigon`, `polygon_pos` or `eth_mainnet` must be selected");
zk_evm_common::check_chain_features!();

use std::env;
use std::fs::File;
Expand Down

0 comments on commit 0b71dc0

Please sign in to comment.