Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion cmd/ethrex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ rand = "0.8.5"
rayon.workspace = true
local-ip-address = "0.6"
tokio-util.workspace = true
lazy_static.workspace = true
secp256k1.workspace = true
reqwest.workspace = true
thiserror.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions cmd/ethrex/l2/deployer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
path::PathBuf,
process::{Command, Stdio},
str::FromStr,
sync::LazyLock,
};

use bytes::Bytes;
Expand Down Expand Up @@ -568,9 +569,8 @@ pub async fn deploy_l1_contracts(
Ok(contract_addresses)
}

lazy_static::lazy_static! {
static ref SALT: std::sync::Mutex<H256> = std::sync::Mutex::new(H256::zero());
}
static SALT: LazyLock<std::sync::Mutex<H256>> =
LazyLock::new(|| std::sync::Mutex::new(H256::zero()));

async fn deploy_contracts(
eth_client: &EthClient,
Expand Down
1 change: 0 additions & 1 deletion crates/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ libc = "0.2"
crc32fast.workspace = true
bytes.workspace = true
hex.workspace = true
lazy_static.workspace = true
rayon.workspace = true
url.workspace = true
rkyv.workspace = true
Expand Down
1 change: 0 additions & 1 deletion crates/common/rlp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ tinyvec = "1.6.0"
thiserror.workspace = true
bytes.workspace = true
hex.workspace = true
lazy_static.workspace = true
ethereum-types.workspace = true
snap.workspace = true

Expand Down
1 change: 0 additions & 1 deletion crates/common/trie/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ serde_json = "1.0.117"
rocksdb = { workspace = true, optional = true }
smallvec = { version = "1.10.0", features = ["const_generics", "union"] }
digest = "0.10.6"
lazy_static.workspace = true
crossbeam.workspace = true
rustc-hash.workspace = true
rkyv.workspace = true
Expand Down
11 changes: 3 additions & 8 deletions crates/common/trie/trie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ethrex_rlp::constants::RLP_NULL;
use ethrex_rlp::encode::RLPEncode;
use rustc_hash::FxHashSet;
use std::collections::BTreeMap;
use std::sync::{Arc, Mutex};
use std::sync::{Arc, LazyLock, Mutex};

pub use self::db::{InMemoryTrieDB, TrieDB};
pub use self::logger::{TrieLogger, TrieWitness};
Expand All @@ -32,14 +32,9 @@ pub use self::error::{ExtensionNodeErrorData, InconsistentTreeError, TrieError};
use self::{node::LeafNode, trie_iter::TrieIterator};

use ethrex_rlp::decode::RLPDecode;
use lazy_static::lazy_static;

lazy_static! {
// Hash value for an empty trie, equal to keccak(RLP_NULL)
pub static ref EMPTY_TRIE_HASH: H256 = H256(
keccak_hash([RLP_NULL]),
);
}
// Hash value for an empty trie, equal to keccak(RLP_NULL)
pub static EMPTY_TRIE_HASH: LazyLock<H256> = LazyLock::new(|| H256(keccak_hash([RLP_NULL])));

/// RLP-encoded trie path
pub type PathRLP = Vec<u8>;
Expand Down
23 changes: 11 additions & 12 deletions crates/common/types/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use std::{
collections::{BTreeMap, HashMap},
io::{BufReader, Error},
path::Path,
sync::LazyLock,
};
use tracing::warn;

Expand Down Expand Up @@ -266,18 +267,16 @@ pub struct ChainConfig {
pub enable_verkle_at_genesis: bool,
}

lazy_static::lazy_static! {
pub static ref NETWORK_NAMES: HashMap<u64, &'static str> = {
HashMap::from([
(1, "mainnet"),
(11155111, "sepolia"),
(17000, "holesky"),
(560048, "hoodi"),
(9, "L1 local devnet"),
(65536999, "L2 local devnet"),
])
};
}
pub static NETWORK_NAMES: LazyLock<HashMap<u64, &'static str>> = LazyLock::new(|| {
HashMap::from([
(1, "mainnet"),
(11155111, "sepolia"),
(17000, "holesky"),
(560048, "hoodi"),
(9, "L1 local devnet"),
(65536999, "L2 local devnet"),
])
});

#[repr(u8)]
#[derive(Debug, PartialEq, Eq, PartialOrd, Default, Hash, Clone, Copy, Serialize, Deserialize)]
Expand Down
1 change: 0 additions & 1 deletion crates/l2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ futures.workspace = true
directories = "5.0.1"
bincode = "1.3.3"
serde_with.workspace = true
lazy_static.workspace = true
aligned-sdk.workspace = true
ethers = "2.0"
chrono = "0.4.41"
Expand Down
5 changes: 0 additions & 5 deletions crates/l2/prover/src/guest_program/src/sp1/Cargo.lock

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

1 change: 0 additions & 1 deletion crates/l2/sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ ethrex-rlp.workspace = true
bytes.workspace = true
reqwest.workspace = true
eyre.workspace = true
lazy_static.workspace = true

[lib]
name = "ethrex_l2_sdk"
Expand Down
1 change: 0 additions & 1 deletion crates/networking/p2p/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ tokio-util = { workspace = true, features = ["codec", "net"] }
bytes.workspace = true
hex.workspace = true
thiserror.workspace = true
lazy_static.workspace = true
snap.workspace = true
serde.workspace = true
secp256k1.workspace = true
Expand Down
43 changes: 24 additions & 19 deletions crates/networking/p2p/snap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,25 +189,30 @@ mod tests {
// Hive `AccounRange` Tests
// Requests & invariantes taken from https://github.com/ethereum/go-ethereum/blob/3e567b8b2901611f004b5a6070a9b6d286be128d/cmd/devp2p/internal/ethtest/snap.go#L69

use lazy_static::lazy_static;

lazy_static! {
// Constant values for hive `AccountRange` tests
static ref HASH_MIN: H256 = H256::zero();
static ref HASH_MAX: H256 =
H256::from_str("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",)
.unwrap();
static ref HASH_FIRST: H256 =
H256::from_str("0x005e94bf632e80cde11add7d3447cd4ca93a5f2205d9874261484ae180718bd6")
.unwrap();
static ref HASH_SECOND: H256 =
H256::from_str("0x00748bacab20da9ae19dd26a33bd10bbf825e28b3de84fc8fe1d15a21645067f")
.unwrap();
static ref HASH_FIRST_MINUS_500: H256 = H256::from_uint(&((*HASH_FIRST).into_uint() - 500));
static ref HASH_FIRST_MINUS_450: H256 = H256::from_uint(&((*HASH_FIRST).into_uint() - 450));
static ref HASH_FIRST_MINUS_ONE: H256 = H256::from_uint(&((*HASH_FIRST).into_uint() - 1));
static ref HASH_FIRST_PLUS_ONE: H256 = H256::from_uint(&((*HASH_FIRST).into_uint() + 1));
}
use std::sync::LazyLock;

// Constant values for hive `AccountRange` tests
static HASH_MIN: LazyLock<H256> = LazyLock::new(H256::zero);
static HASH_MAX: LazyLock<H256> = LazyLock::new(|| {
H256::from_str("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")
.unwrap()
});
static HASH_FIRST: LazyLock<H256> = LazyLock::new(|| {
H256::from_str("0x005e94bf632e80cde11add7d3447cd4ca93a5f2205d9874261484ae180718bd6")
.unwrap()
});
static HASH_SECOND: LazyLock<H256> = LazyLock::new(|| {
H256::from_str("0x00748bacab20da9ae19dd26a33bd10bbf825e28b3de84fc8fe1d15a21645067f")
.unwrap()
});
static HASH_FIRST_MINUS_500: LazyLock<H256> =
LazyLock::new(|| H256::from_uint(&((*HASH_FIRST).into_uint() - 500)));
static HASH_FIRST_MINUS_450: LazyLock<H256> =
LazyLock::new(|| H256::from_uint(&((*HASH_FIRST).into_uint() - 450)));
static HASH_FIRST_MINUS_ONE: LazyLock<H256> =
LazyLock::new(|| H256::from_uint(&((*HASH_FIRST).into_uint() - 1)));
static HASH_FIRST_PLUS_ONE: LazyLock<H256> =
LazyLock::new(|| H256::from_uint(&((*HASH_FIRST).into_uint() + 1)));

#[tokio::test]
async fn hive_account_range_a() -> Result<(), StoreError> {
Expand Down
17 changes: 10 additions & 7 deletions crates/networking/p2p/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use std::{
cmp::min,
collections::HashMap,
sync::{
Arc,
Arc, LazyLock,
atomic::{AtomicBool, Ordering},
},
};
Expand All @@ -61,13 +61,16 @@ const BYTECODE_CHUNK_SIZE: usize = 50_000;
const MISSING_SLOTS_PERCENTAGE: f64 = 0.8;

#[cfg(feature = "sync-test")]
lazy_static::lazy_static! {
static ref EXECUTE_BATCH_SIZE: usize = std::env::var("EXECUTE_BATCH_SIZE").map(|var| var.parse().expect("Execute batch size environmental variable is not a number")).unwrap_or(EXECUTE_BATCH_SIZE_DEFAULT);
}
static EXECUTE_BATCH_SIZE: LazyLock<usize> = LazyLock::new(|| {
std::env::var("EXECUTE_BATCH_SIZE")
.map(|var| {
var.parse()
.expect("Execute batch size environmental variable is not a number")
})
.unwrap_or(EXECUTE_BATCH_SIZE_DEFAULT)
});
#[cfg(not(feature = "sync-test"))]
lazy_static::lazy_static! {
static ref EXECUTE_BATCH_SIZE: usize = EXECUTE_BATCH_SIZE_DEFAULT;
}
static EXECUTE_BATCH_SIZE: LazyLock<usize> = LazyLock::new(|| EXECUTE_BATCH_SIZE_DEFAULT);

#[derive(Debug, PartialEq, Clone, Default)]
pub enum SyncMode {
Expand Down
1 change: 0 additions & 1 deletion crates/vm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ ethrex-rlp.workspace = true
derive_more = { version = "1.0.0", features = ["full"] }
bytes.workspace = true
thiserror.workspace = true
lazy_static.workspace = true
tracing.workspace = true
serde.workspace = true
rkyv.workspace = true
Expand Down
1 change: 0 additions & 1 deletion crates/vm/levm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ authors.workspace = true
documentation.workspace = true

[dependencies]
lazy_static.workspace = true
ethrex-common.workspace = true
ethrex-crypto.workspace = true
ethrex-rlp.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions crates/vm/levm/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,6 @@ pub const P256_N: P256Uint = NistP256::ORDER;
pub const P256_A: P256FieldElement = P256FieldElement::from_u64(3).neg();
pub const P256_B_UINT: P256Uint =
P256Uint::from_be_hex("5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b");
lazy_static::lazy_static! {
pub static ref P256_B: P256FieldElement = P256FieldElement::from_uint(P256_B_UINT).unwrap();
}

pub static P256_B: LazyLock<P256FieldElement> =
LazyLock::new(|| P256FieldElement::from_uint(P256_B_UINT).unwrap());
Loading
Loading