Skip to content
Open
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
58 changes: 50 additions & 8 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repository = "https://github.com/mintlayer/mintlayer-core"
readme = "README.md"
license = "MIT"
version = "1.3.0"
edition = "2021"
edition = "2024"

[workspace]
members = [
Expand Down Expand Up @@ -126,7 +126,7 @@ storage = { path = "storage" }
utxo = { path = "utxo" }

[workspace.package]
edition = "2021"
edition = "2024"
rust-version = "1.88"
version = "1.3.0"
license = "MIT"
Expand Down Expand Up @@ -156,7 +156,7 @@ console-subscriber = "0.5"
criterion = "0.5"
crossterm = "0.28"
csv = "1.3"
ctor = "0.2"
ctor = "0.10"
derive_more = { version = "1.0", features = ["full"] }
directories = "5.0"
humantime = "2.1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1038,10 +1038,10 @@ impl ApiServerInMemoryStorage {

// Handle a degenerate case when the block is stored several times using different heights
// (to be consistent with the postgres implementation).
if let Some(previously_stored_height) = previously_stored_height {
if previously_stored_height != block_height {
self.main_chain_blocks_table.remove(&previously_stored_height);
}
if let Some(previously_stored_height) = previously_stored_height
&& previously_stored_height != block_height
{
self.main_chain_blocks_table.remove(&previously_stored_height);
}

Ok(())
Expand Down
1 change: 1 addition & 0 deletions api-server/scanner-daemon/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ utils = { path = "../../utils" }
utils-networking = { path = "../../utils/networking" }

clap = { workspace = true, features = ["derive"] }
ctor.workspace = true
thiserror.workspace = true
tokio = { workspace = true, features = ["full"] }

Expand Down
8 changes: 2 additions & 6 deletions api-server/scanner-daemon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,10 @@ pub enum ApiServerScannerError {
PostgresConnectionError(ApiServerStorageError),
}

utils::enable_rust_backtrace!();

#[tokio::main]
async fn main() -> Result<(), ApiServerScannerError> {
utils::rust_backtrace::enable();

if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "info");
}

let args = ApiServerScannerArgs::parse();

logging::init_logging();
Expand Down
1 change: 1 addition & 0 deletions api-server/storage-test-suite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ serialization = { path = "../../serialization" }

async-trait.workspace = true
chrono.workspace = true
ctor.workspace = true
futures = { workspace = true, default-features = false }
libtest-mimic.workspace = true
proptest.workspace = true
Expand Down
5 changes: 2 additions & 3 deletions api-server/storage-test-suite/tests/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ use api_server_common::storage::{
storage_api::ApiServerStorage,
};
use common::chain::{config::create_unit_test_config, ChainConfig};
use utils::rust_backtrace;

#[must_use]
#[allow(clippy::unused_async)]
async fn make_in_memory_storage(chain_config: Arc<ChainConfig>) -> impl ApiServerStorage {
TransactionalApiServerInMemoryStorage::new(&chain_config)
}

fn main() {
rust_backtrace::enable();
utils::enable_rust_backtrace!();

fn main() {
let storage_maker = || make_in_memory_storage(Arc::new(create_unit_test_config()));
let result = api_server_backend_test_suite::run(storage_maker);

Expand Down
5 changes: 2 additions & 3 deletions api-server/storage-test-suite/tests/postgres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ use api_server_common::storage::{
};
use common::chain::{config::create_unit_test_config, ChainConfig};
use containers::with_container::ApiServerStorageWithContainer;
use utils::rust_backtrace;

#[must_use]
async fn make_postgres_storage(chain_config: Arc<ChainConfig>) -> impl ApiServerStorage {
Expand Down Expand Up @@ -56,9 +55,9 @@ async fn make_postgres_storage(chain_config: Arc<ChainConfig>) -> impl ApiServer
ApiServerStorageWithContainer::new(storage, podman)
}

fn main() {
rust_backtrace::enable();
utils::enable_rust_backtrace!();

fn main() {
// Only run the test if the env var is defined
if std::env::var("ML_CONTAINERIZED_TESTS").is_err() {
eprintln!("Warning: Skipping Postgres containerized tests");
Expand Down
1 change: 1 addition & 0 deletions api-server/web-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ mempool = { path = "../../mempool" }

axum.workspace = true
async-trait.workspace = true
ctor.workspace = true
clap = { workspace = true, features = ["derive"] }
hex.workspace = true
serde = { workspace = true, features = ["derive"] }
Expand Down
6 changes: 2 additions & 4 deletions api-server/web-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ use utils::{cookie::COOKIE_FILENAME, default_data_dir::default_data_dir_for_chai

use crate::error::ApiServerWebServerInitError;

utils::enable_rust_backtrace!();

#[tokio::main]
async fn main() -> Result<(), ApiServerWebServerInitError> {
if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "info");
}

logging::init_logging();

let args = ApiServerWebServerConfig::parse();
Expand Down
2 changes: 1 addition & 1 deletion chainstate/db-dumper/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ utils = { path = "../../utils" }

anyhow.workspace = true
clap.workspace = true
ctor.workspace = true
itertools.workspace = true
strum.workspace = true
thiserror.workspace = true
Expand All @@ -30,7 +31,6 @@ crypto = { path = "../../crypto" }
mocks = { path = "../../mocks" }
test-utils = { path = "../../test-utils" }

ctor.workspace = true
hex.workspace = true
rstest.workspace = true

Expand Down
8 changes: 2 additions & 6 deletions chainstate/db-dumper/src/dumper/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,9 @@ fn run() -> anyhow::Result<()> {
Ok(())
}

fn main() {
utils::rust_backtrace::enable();

if std::env::var("RUST_LOG").is_err() {
std::env::set_var("RUST_LOG", "info");
}
utils::enable_rust_backtrace!();

fn main() {
init_logging();

run().unwrap_or_else(|err| {
Expand Down
12 changes: 7 additions & 5 deletions chainstate/launcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ fn make_chainstate_impl(
fn create_lmdb_storage(
datadir: &std::path::Path,
chain_config: &ChainConfig,
) -> Result<impl BlockchainStorage, Error> {
) -> Result<impl BlockchainStorage + use<>, Error> {
let lmdb_resize_callback = MapResizeCallback::new(Box::new(|resize_info| {
logging::log::info!("Lmdb resize happened: {:?}", resize_info)
}));
Expand All @@ -126,14 +126,16 @@ fn create_lmdb_storage(
create_storage(backend, chain_config)
}

fn create_inmemory_storage(chain_config: &ChainConfig) -> Result<impl BlockchainStorage, Error> {
fn create_inmemory_storage(
chain_config: &ChainConfig,
) -> Result<impl BlockchainStorage + use<>, Error> {
create_storage(storage_inmemory::InMemory::new(), chain_config)
}

fn create_storage(
storage_backend: impl BlockchainStorageBackend + 'static,
fn create_storage<B: BlockchainStorageBackend + 'static>(
storage_backend: B,
chain_config: &ChainConfig,
) -> Result<impl BlockchainStorage, Error> {
) -> Result<impl BlockchainStorage + use<B>, Error> {
let storage = chainstate_storage::Store::new(storage_backend, chain_config)
.map_err(|e| Error::FailedToInitializeChainstate(e.into()))?;

Expand Down
Loading
Loading