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
80 changes: 52 additions & 28 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ soroban-ledger-snapshot = { version = "22.0.8", path = "soroban-ledger-snapshot"
soroban-token-sdk = { version = "22.0.8", path = "soroban-token-sdk" }

[workspace.dependencies.soroban-env-common]
version = "=22.1.3"
version = "=23.0.0-rc.1.1"
#git = "https://github.com/stellar/rs-soroban-env"
#rev = "bd0c80a1fe171e75f8d745f17975a73927d44ecd"

[workspace.dependencies.soroban-env-guest]
version = "=22.1.3"
version = "=23.0.0-rc.1.1"
#git = "https://github.com/stellar/rs-soroban-env"
#rev = "bd0c80a1fe171e75f8d745f17975a73927d44ecd"

[workspace.dependencies.soroban-env-host]
version = "=22.1.3"
version = "=23.0.0-rc.1.1"
#git = "https://github.com/stellar/rs-soroban-env"
#rev = "bd0c80a1fe171e75f8d745f17975a73927d44ecd"

[workspace.dependencies.stellar-strkey]
version = "=0.0.9"
version = "=0.0.13"

[workspace.dependencies.stellar-xdr]
version = "=22.1.0"
version = "=23.0.0-rc.1"
default-features = false
features = ["curr"]
#git = "https://github.com/stellar/rs-stellar-xdr"
Expand Down
2 changes: 1 addition & 1 deletion soroban-ledger-snapshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ edition = "2021"
rust-version.workspace = true

[dependencies]
soroban-env-host = { workspace = true }
soroban-env-host = { workspace = true, features = ["testutils"] }
soroban-env-common = {workspace = true, features = ["serde"]}
serde = { version = "1.0.0", features = ["derive"] }
serde_with = { version = "3.4.0", features = ["hex"] }
Expand Down
7 changes: 2 additions & 5 deletions soroban-ledger-snapshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ impl LedgerSnapshot {
self.set_ledger_info(li.clone());
Ok(())
});
let _result = host.with_mut_storage(|s| {
self.update_entries(&s.map);
Ok(())
});
self.update_entries(&host.get_stored_entries().unwrap());
}

// Get the ledger info in the snapshot.
Expand Down Expand Up @@ -168,7 +165,7 @@ impl LedgerSnapshot {
impl Default for LedgerSnapshot {
fn default() -> Self {
Self {
protocol_version: 22,
protocol_version: 23,
sequence_number: Default::default(),
timestamp: Default::default(),
network_id: Default::default(),
Expand Down
5 changes: 3 additions & 2 deletions soroban-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ soroban-env-guest = { workspace = true }

[target.'cfg(not(target_family="wasm"))'.dependencies]
soroban-env-host = { workspace = true, features = [] }
soroban-ledger-snapshot = { workspace = true }
soroban-ledger-snapshot = { workspace = true, optional = true }
stellar-strkey = { workspace = true }
arbitrary = { version = "~1.3.0", features = ["derive"], optional = true }
derive_arbitrary = { version = "~1.3.0", optional = true }
Expand All @@ -44,6 +44,7 @@ soroban-sdk-macros = { workspace = true, features = ["testutils"] }
soroban-env-host = { 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"
Expand All @@ -57,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"]
testutils = ["soroban-sdk-macros/testutils", "soroban-env-host/testutils", "dep:ed25519-dalek", "dep:arbitrary", "dep:derive_arbitrary", "dep:ctor", "dep:soroban-ledger-snapshot"]
hazmat = []
docs = []

Expand Down
15 changes: 10 additions & 5 deletions soroban-sdk/src/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ impl Debug for Address {
let strkey = Strkey::PublicKeyEd25519(ed25519::PublicKey(ed25519));
write!(f, "AccountId({})", strkey.to_string())?;
}
xdr::ScAddress::Contract(contract_id) => {
xdr::ScAddress::Contract(xdr::ContractId(contract_id)) => {
let strkey = Strkey::Contract(Contract(contract_id.0));
write!(f, "Contract({})", strkey.to_string())?;
}
ScAddress::MuxedAccount(_)
| ScAddress::ClaimableBalance(_)
| ScAddress::LiquidityPool(_) => {
return Err(core::fmt::Error);
}
}
} else {
return Err(core::fmt::Error);
Expand Down Expand Up @@ -316,7 +321,7 @@ impl Address {
}

#[cfg(any(not(target_family = "wasm"), test, feature = "testutils"))]
use crate::env::xdr::Hash;
use crate::env::xdr::{ContractId, Hash};
use crate::unwrap::UnwrapOptimized;

#[cfg(any(test, feature = "testutils"))]
Expand All @@ -325,15 +330,15 @@ impl crate::testutils::Address for Address {
fn generate(env: &Env) -> Self {
Self::try_from_val(
env,
&ScAddress::Contract(Hash(env.with_generator(|mut g| g.address()))),
&ScAddress::Contract(ContractId(Hash(env.with_generator(|mut g| g.address())))),
)
.unwrap()
}
}

#[cfg(not(target_family = "wasm"))]
impl Address {
pub(crate) fn contract_id(&self) -> Hash {
pub(crate) fn contract_id(&self) -> ContractId {
let sc_address: ScAddress = self.try_into().unwrap();
if let ScAddress::Contract(c) = sc_address {
c
Expand All @@ -343,6 +348,6 @@ impl Address {
}

pub(crate) fn from_contract_id(env: &Env, contract_id: [u8; 32]) -> Self {
Self::try_from_val(env, &ScAddress::Contract(Hash(contract_id))).unwrap()
Self::try_from_val(env, &ScAddress::Contract(ContractId(Hash(contract_id)))).unwrap()
}
}
Loading