diff --git a/soroban-ledger-snapshot/Cargo.toml b/soroban-ledger-snapshot/Cargo.toml index e17b3c49a..c84e5cfdd 100644 --- a/soroban-ledger-snapshot/Cargo.toml +++ b/soroban-ledger-snapshot/Cargo.toml @@ -11,7 +11,7 @@ edition = "2021" rust-version.workspace = true [dependencies] -soroban-env-host = { workspace = true, features = ["testutils"] } +soroban-env-host = { workspace = true } soroban-env-common = {workspace = true, features = ["serde"]} serde = { version = "1.0.0", features = ["derive"] } serde_with = { version = "3.4.0", features = ["hex"] } @@ -20,3 +20,6 @@ thiserror = "1.0" [dev-dependencies] pretty_assertions = "1.2.1" + +[features] +testutils = ["soroban-env-host/testutils"] diff --git a/soroban-ledger-snapshot/src/lib.rs b/soroban-ledger-snapshot/src/lib.rs index 6bc349d9f..ca3a46c5a 100644 --- a/soroban-ledger-snapshot/src/lib.rs +++ b/soroban-ledger-snapshot/src/lib.rs @@ -9,7 +9,7 @@ use std::{ use soroban_env_host::{ storage::SnapshotSource, xdr::{LedgerEntry, LedgerKey}, - Host, HostError, LedgerInfo, + HostError, LedgerInfo, }; #[derive(thiserror::Error, Debug)] @@ -50,13 +50,14 @@ impl LedgerSnapshot { s } - /// Update the snapshot with the state within the given [`Host`]. + /// Update the snapshot with the state within the given [`soroban_env_host::Host`]. /// /// The ledger info of the host will overwrite the ledger info in the /// snapshot. The entries in the host's storage will overwrite entries in /// the snapshot. Existing entries in the snapshot that are untouched by the /// host will remain. - pub fn update(&mut self, host: &Host) { + #[cfg(feature = "testutils")] + pub fn update(&mut self, host: &soroban_env_host::Host) { let _result = host.with_ledger_info(|li| { self.set_ledger_info(li.clone()); Ok(()) diff --git a/soroban-sdk/Cargo.toml b/soroban-sdk/Cargo.toml index ed7c71530..f8564b1e7 100644 --- a/soroban-sdk/Cargo.toml +++ b/soroban-sdk/Cargo.toml @@ -42,9 +42,9 @@ ctor = { version = "0.2.9", optional = true } [dev-dependencies] soroban-sdk-macros = { workspace = true, features = ["testutils"] } soroban-env-host = { workspace = true, features = ["testutils"] } +soroban-ledger-snapshot = { workspace = true, features = ["testutils"] } stellar-xdr = { workspace = true, features = ["curr", "std"] } soroban-spec = { workspace = true } -soroban-ledger-snapshot = { workspace = true } ed25519-dalek = "2.0.0" rand = "0.8.5" ctor = "0.2.9" @@ -58,7 +58,7 @@ expect-test = "1.4.1" [features] alloc = [] -testutils = ["soroban-sdk-macros/testutils", "soroban-env-host/testutils", "dep:ed25519-dalek", "dep:arbitrary", "dep:derive_arbitrary", "dep:ctor", "dep:soroban-ledger-snapshot"] +testutils = ["soroban-sdk-macros/testutils", "soroban-env-host/testutils", "soroban-ledger-snapshot/testutils", "dep:ed25519-dalek", "dep:arbitrary", "dep:derive_arbitrary", "dep:ctor", "dep:soroban-ledger-snapshot"] hazmat = [] docs = []