Skip to content

Commit

Permalink
Merge branch 'nightly' into erce/update-core-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ercecan committed Dec 17, 2024
2 parents 33ba1bd + 7e1480b commit 8f8360f
Show file tree
Hide file tree
Showing 122 changed files with 3,152 additions and 1,921 deletions.
332 changes: 249 additions & 83 deletions Cargo.lock

Large diffs are not rendered by default.

44 changes: 20 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ members = [
"crates/pruning",
"crates/risc0",
"crates/sequencer",
"crates/sequencer-client",
"crates/soft-confirmation-rule-enforcer",
# "crates/sp1",
# Sovereign sdk
Expand Down Expand Up @@ -49,13 +48,9 @@ publish = false
repository = "https://github.com/chainwayxyz/citrea"

[workspace.dependencies]
# Dependencies maintained by Sovereign
jmt = { git = "https://github.com/penumbra-zone/jmt.git", rev = "fd1c8ef" }

# External dependencies
async-trait = "0.1.71"
anyhow = { version = "1.0.68", default-features = false }
arbitrary = { version = "1.3.1", features = ["derive"] }
backoff = { version = "0.4.0", features = ["futures", "tokio"] }
borsh = { version = "1.5", default-features = false, features = ["derive"] }
# TODO: Consider replacing this serialization format
Expand All @@ -64,48 +59,56 @@ bincode = "1.3.3"
bitcoin = { version = "0.32.2", features = ["serde", "rand"] }
bitcoincore-rpc = { version = "0.18.0" }
bcs = "0.1.6"
bech32 = { version = "0.9.1", default-features = false }
brotli = "7"
byteorder = { version = "1.5.0", default-features = false }
bytes = { version = "1.2.1", default-features = false }
chrono = { version = "0.4.37", default-features = false }
clap = { version = "4.4.10", features = ["derive"] }
crypto-bigint = { version = "0.5.5" }
digest = { version = "0.10.6", default-features = false, features = ["alloc"] }
derive_more = { version = "0.99.11", default-features = false }
ed25519-dalek = { version = "2", default-features = false, features = ["serde", "fast"] }
futures = "0.3"
hyper = { version = "1.4.0" }
itertools = { version = "0.13.0", default-features = false }
jmt = { git = "https://github.com/penumbra-zone/jmt.git", rev = "fd1c8ef" }
jsonrpsee = { version = "0.24.2", features = ["jsonrpsee-types"] }
lru = "0.12.3"
rs_merkle = "1.4.2"
futures = "0.3"
pin-project = { version = "1.1.3" }
hex = { version = "0.4.3", default-features = false, features = ["alloc", "serde"] }
lazy_static = { version = "1.5.0" }
log-panics = { version = "2", features = ["with-backtrace"] }
once_cell = { version = "1.19.0", default-features = false, features = ["alloc"] }
metrics = { version = "0.23.0" }
metrics-derive = { version = "0.1.0" }
metrics-exporter-prometheus = { version = "0.15.3" }
metrics-util = { version = "0.17.0" }
num_cpus = "1.0"
parking_lot = { version = "0.12.3" }
prometheus = { version = "0.13.3", default-features = false }
proptest = { version = "1.3.1", default-features = false, features = ["alloc"] }
proptest-derive = "0.4.0"
pin-project = { version = "1.1.3" }
rand = "0.8"
rayon = "1.8.0"
rlimit = "0.10.2"
rustc_version_runtime = { version = "0.3.0", default-features = false }
rs_merkle = "1.4.2"
reqwest = { version = "0.12.5", features = ["rustls-tls", "json", "http2"], default-features = false }
rocksdb = { version = "0.22.0", features = ["lz4"], default-features = false }
serde = { version = "1.0.192", default-features = false, features = ["alloc", "derive"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
serde_with = "3.3.0"
sha2 = { version = "0.10.8", default-features = false }
schemars = { version = "0.8.16", features = ["derive"] }
secp256k1 = { version = "0.29.0", default-features = false, features = ["global-context", "recovery"] }
thiserror = "1.0.50"
tracing = { version = "0.1.40", default-features = false, features = ["attributes"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter", "json", "fmt"] }
bech32 = { version = "0.9.1", default-features = false }
derive_more = { version = "0.99.11", default-features = false }
clap = { version = "4.4.10", features = ["derive"] }
toml = "0.8.0"
jsonrpsee = { version = "0.24.2", features = ["jsonrpsee-types"] }
schemars = { version = "0.8.16", features = ["derive"] }
tempfile = "3.8"
tokio = { version = "1.40", features = ["full"] }
tokio-util = { version = "0.7.12", features = ["rt"] }
num_cpus = "1.0"
tower-http = { version = "0.5.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }

# Risc0 dependencies
risc0-binfmt = { version = "1.1.3" }
Expand Down Expand Up @@ -153,14 +156,7 @@ alloy-eips = { version = "0.4.2", default-features = false }
alloy-consensus = { version = "0.4.2", default-features = false, features = ["serde", "serde-bincode-compat"] }
alloy-network = { version = "0.4.2", default-features = false }

ed25519-dalek = { version = "2", default-features = false, features = ["serde", "fast"] }
secp256k1 = { version = "0.29.0", default-features = false, features = ["global-context", "recovery"] }

tower-http = { version = "0.5.0", features = ["full"] }
tower = { version = "0.4.13", features = ["full"] }
hyper = { version = "1.4.0" }

citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "423db61" }
citrea-e2e = { git = "https://github.com/chainwayxyz/citrea-e2e", rev = "51a4d19" }

[patch.crates-io]
bitcoincore-rpc = { version = "0.18.0", git = "https://github.com/chainwayxyz/rust-bitcoincore-rpc.git", rev = "ca3cfa2" }
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ clean: ## Cleans compiled
@cargo clean

clean-node: ## Cleans local dbs needed for sequencer and nodes
rm -rf resources/dbs/da-db
rm -rf resources/dbs/sequencer-db
rm -rf resources/dbs/batch-prover-db
rm -rf resources/dbs/light-client-prover-db
Expand Down
7 changes: 4 additions & 3 deletions bin/citrea/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ citrea-sequencer = { path = "../../crates/sequencer" }
citrea-stf = { path = "../../crates/citrea-stf", features = ["native"] }
ethereum-rpc = { path = "../../crates/ethereum-rpc" }
prover-services = { path = "../../crates/prover-services" }
sequencer-client = { path = "../../crates/sequencer-client" }

# Sovereign-SDK deps
soft-confirmation-rule-enforcer = { path = "../../crates/soft-confirmation-rule-enforcer" }
Expand All @@ -52,6 +51,9 @@ hex = { workspace = true, optional = true }
jsonrpsee = { workspace = true, features = ["http-client", "server"] }
lazy_static = { workspace = true }
log-panics = { workspace = true }
metrics = { workspace = true }
metrics-exporter-prometheus = { workspace = true, default-features = true }
metrics-util = { workspace = true }
reth-primitives = { workspace = true }
reth-transaction-pool = { workspace = true }
risc0-binfmt = { workspace = true }
Expand All @@ -68,7 +70,7 @@ citrea-evm = { path = "../../crates/evm", features = ["native"] }
citrea-primitives = { path = "../../crates/primitives", features = ["testing"] }
sov-mock-da = { path = "../../crates/sovereign-sdk/adapters/mock-da", default-features = false }
sov-prover-storage-manager = { path = "../../crates/sovereign-sdk/full-node/sov-prover-storage-manager", features = ["test-utils"] }
sov-rollup-interface = { path = "../../crates/sovereign-sdk/rollup-interface", features = ["fuzzing", "testing"] }
sov-rollup-interface = { path = "../../crates/sovereign-sdk/rollup-interface", features = ["testing"] }

alloy = { workspace = true, features = ["hyper", "consensus", "rpc-types-eth", "provider-http", "signers", "signer-local"] }
alloy-rlp = { workspace = true }
Expand All @@ -77,7 +79,6 @@ alloy-rpc-types-trace = { workspace = true }
bincode = { workspace = true }
borsh = { workspace = true }
hex = { workspace = true }
proptest = { workspace = true }
reqwest = { workspace = true }
rs_merkle = { workspace = true }
serde_json = { workspace = true }
Expand Down
36 changes: 33 additions & 3 deletions bin/citrea/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use core::fmt::Debug as DebugTrait;
use std::net::SocketAddr;
use std::time::Duration;

use anyhow::Context as _;
use anyhow::{anyhow, Context as _};
use bitcoin_da::service::BitcoinServiceConfig;
use citrea::{
initialize_logging, BitcoinRollup, CitreaRollupBlueprint, MockDemoRollup, NetworkArg,
Expand All @@ -11,11 +13,13 @@ use citrea_common::{
};
use citrea_stf::genesis_config::GenesisPaths;
use clap::Parser;
use metrics_exporter_prometheus::PrometheusBuilder;
use metrics_util::MetricKindMask;
use sov_mock_da::MockDaConfig;
use sov_modules_api::Spec;
use sov_modules_rollup_blueprint::{Network, RollupBlueprint};
use sov_state::storage::NativeStorage;
use tracing::{error, info, instrument};
use tracing::{debug, error, info, instrument};

#[cfg(test)]
mod test_rpc;
Expand Down Expand Up @@ -201,6 +205,26 @@ where
None => FullNodeConfig::from_env()
.context("Failed to read rollup configuration from the environment")?,
};

if rollup_config.telemetry.bind_host.is_some() && rollup_config.telemetry.bind_port.is_some() {
let bind_host = rollup_config.telemetry.bind_host.as_ref().unwrap();
let bind_port = rollup_config.telemetry.bind_port.as_ref().unwrap();
let telemetry_addr: SocketAddr = format!("{}:{}", bind_host, bind_port)
.parse()
.map_err(|_| anyhow!("Invalid telemetry address"))?;

debug!("Starting telemetry server on: {}", telemetry_addr);

let builder = PrometheusBuilder::new().with_http_listener(telemetry_addr);
builder
.idle_timeout(
MetricKindMask::GAUGE | MetricKindMask::HISTOGRAM,
Some(Duration::from_secs(30)),
)
.install()
.map_err(|_| anyhow!("failed to install Prometheus recorder"))?;
}

let rollup_blueprint = S::new(network);

if let Some(sequencer_config) = sequencer_config {
Expand Down Expand Up @@ -232,13 +256,19 @@ where
error!("Error: {}", e);
}
} else if let Some(light_client_prover_config) = light_client_prover_config {
let prover = CitreaRollupBlueprint::create_new_light_client_prover(
let (mut prover, rpc_methods) = CitreaRollupBlueprint::create_new_light_client_prover(
&rollup_blueprint,
rollup_config,
light_client_prover_config,
)
.await
.expect("Could not start light client prover");

prover
.start_rpc_server(rpc_methods, None)
.await
.expect("Failed to start rpc server");

if let Err(e) = prover.run().await {
error!("Error: {}", e);
}
Expand Down
15 changes: 9 additions & 6 deletions bin/citrea/src/rollup/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use citrea_batch_prover::CitreaBatchProver;
use citrea_common::tasks::manager::TaskManager;
use citrea_common::{BatchProverConfig, FullNodeConfig, LightClientProverConfig, SequencerConfig};
use citrea_fullnode::CitreaFullnode;
use citrea_light_client_prover::runner::{CitreaLightClientProver, LightClientProver};
use citrea_light_client_prover::runner::CitreaLightClientProver;
use citrea_primitives::forks::FORKS;
use citrea_sequencer::CitreaSequencer;
use jsonrpsee::RpcModule;
Expand Down Expand Up @@ -424,7 +424,13 @@ pub trait CitreaRollupBlueprint: RollupBlueprint {
&self,
rollup_config: FullNodeConfig<Self::DaConfig>,
prover_config: LightClientProverConfig,
) -> Result<LightClientProver<Self>, anyhow::Error>
) -> Result<
(
CitreaLightClientProver<Self::DaService, Self::Vm, Self::ProverService, LedgerDB>,
RpcModule<()>,
),
anyhow::Error,
>
where
<Self::NativeContext as Spec>::Storage: NativeStorage,
{
Expand Down Expand Up @@ -501,9 +507,6 @@ pub trait CitreaRollupBlueprint: RollupBlueprint {
task_manager,
)?;

Ok(LightClientProver {
runner,
rpc_methods,
})
Ok((runner, rpc_methods))
}
}
3 changes: 1 addition & 2 deletions bin/citrea/src/test_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ fn test_helper(
.await
.unwrap();
let addr = server.local_addr().unwrap();
let server_rpc_module =
sov_ledger_rpc::server::rpc_module::<LedgerDB, u32, u32>(ledger_db).unwrap();
let server_rpc_module = sov_ledger_rpc::server::create_rpc_module::<LedgerDB>(ledger_db);
let _server_handle = server.start(server_rpc_module);

let rpc_config = RpcConfig {
Expand Down
Loading

0 comments on commit 8f8360f

Please sign in to comment.