Skip to content

Commit

Permalink
don't compile optimism crates with scroll feature
Browse files Browse the repository at this point in the history
Signed-off-by: Gregory Edison <gregory.edison1993@gmail.com>
  • Loading branch information
greged93 committed Nov 19, 2024
1 parent a667eae commit 8a08dfb
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 3 deletions.
1 change: 1 addition & 0 deletions crates/optimism/bin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ optimism = [
"reth-optimism-rpc/optimism",
"reth-provider/optimism"
]
scroll = []

dev = [
"reth-optimism-cli/dev"
Expand Down
3 changes: 3 additions & 0 deletions crates/optimism/bin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

/// Re-exported from `reth_optimism_cli`.
pub mod cli {
Expand Down
3 changes: 3 additions & 0 deletions crates/optimism/bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#![allow(missing_docs, rustdoc::missing_crate_level_docs)]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

use clap::Parser;
use reth_node_builder::{engine_tree_config::TreeConfig, EngineNodeLauncher};
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,4 @@ serde = [
"reth-execution-types/serde",
"reth-provider/serde"
]
scroll = []
3 changes: 3 additions & 0 deletions crates/optimism/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

/// Optimism chain specification parser.
pub mod chainspec;
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,4 @@ optimism = [
"revm/optimism",
"revm-primitives/optimism"
]
scroll = []
3 changes: 1 addition & 2 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,8 @@ mod tests {
fn create_op_state_provider() -> StateProviderTest {
let mut db = StateProviderTest::default();

// TODO (scroll): remove at last Scroll `Account` related PR.
let l1_block_contract_account =
Account { balance: U256::ZERO, bytecode_hash: None, nonce: 1, ..Default::default() };
Account { balance: U256::ZERO, bytecode_hash: None, nonce: 1 };

let mut l1_block_storage = HashMap::default();
// base fee
Expand Down
3 changes: 3 additions & 0 deletions crates/optimism/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#![cfg_attr(not(feature = "std"), no_std)]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

extern crate alloc;

Expand Down
1 change: 1 addition & 0 deletions crates/optimism/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ test-utils = [
"revm/test-utils",
"reth-optimism-node/test-utils",
]
scroll = []
3 changes: 3 additions & 0 deletions crates/optimism/node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

/// CLI argument parsing for the optimism node.
pub mod args;
Expand Down
3 changes: 3 additions & 0 deletions crates/optimism/node/tests/e2e/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![allow(missing_docs)]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

#[cfg(feature = "optimism")]
mod p2p;
Expand Down
3 changes: 3 additions & 0 deletions crates/optimism/node/tests/it/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#![allow(missing_docs)]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

#[cfg(feature = "optimism")]
mod builder;
Expand Down
3 changes: 2 additions & 1 deletion crates/optimism/payload/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,5 @@ optimism = [
"revm/optimism",
"reth-execution-types/optimism",
"reth-optimism-consensus/optimism"
]
]
scroll = []
3 changes: 3 additions & 0 deletions crates/optimism/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#![allow(clippy::useless_let_if_seq)]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

pub mod builder;
pub use builder::OpPayloadBuilder;
Expand Down
1 change: 1 addition & 0 deletions crates/optimism/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,4 @@ optimism = [
"reth-optimism-consensus/optimism",
"reth-optimism-payload-builder/optimism"
]
scroll = []
3 changes: 3 additions & 0 deletions crates/optimism/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
#![cfg_attr(docsrs, feature(doc_cfg, doc_auto_cfg))]
// The `optimism` feature must be enabled to use this crate.
#![cfg(feature = "optimism")]
// Don't use the crate if `scroll` feature is used.
#![cfg_attr(feature = "scroll", allow(unused_crate_dependencies))]
#![cfg(not(feature = "scroll"))]

pub mod error;
pub mod eth;
Expand Down

0 comments on commit 8a08dfb

Please sign in to comment.