Skip to content
Merged
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
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions cmd/ethrex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ethrex-config.workspace = true
ethrex-blockchain.workspace = true
ethrex-rpc.workspace = true
ethrex-common.workspace = true
ethrex-crypto.workspace = true
ethrex-p2p.workspace = true
ethrex-storage.workspace = true
ethrex-vm.workspace = true
Expand Down Expand Up @@ -70,6 +71,7 @@ c-kzg = [
"ethrex-common/c-kzg",
"ethrex-blockchain/c-kzg",
"ethrex-p2p/c-kzg",
"ethrex-crypto/c-kzg",
]
metrics = ["ethrex-blockchain/metrics", "ethrex-l2/metrics"]
rocksdb = ["ethrex-storage/rocksdb", "ethrex-p2p/rocksdb"]
Expand Down
2 changes: 2 additions & 0 deletions cmd/ethrex/initializers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,8 @@ pub async fn init_l1(
display_chain_initialization(&genesis);

raise_fd_limit()?;
debug!("Preloading KZG trusted setup");
ethrex_crypto::kzg::warm_up_trusted_setup();

let store = init_store(datadir, genesis).await;

Expand Down
8 changes: 8 additions & 0 deletions crates/common/crypto/kzg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ type Blob = [u8; BYTES_PER_BLOB];
type Commitment = Bytes48;
type Proof = Bytes48;

/// Ensures the Ethereum trusted setup is loaded so later KZG operations avoid the first-call cost.
pub fn warm_up_trusted_setup() {
#[cfg(feature = "c-kzg")]
{
let _ = c_kzg::ethereum_kzg_settings(8);
}
}

#[derive(thiserror::Error, Debug)]
pub enum KzgError {
#[cfg(feature = "c-kzg")]
Expand Down
Loading