From 2382cf1ade32f6a6bf12cabd0a7b4aa889864693 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Mon, 22 Aug 2022 17:17:22 -0700 Subject: [PATCH] Update stellar-env-* --- Cargo.lock | 10 +++++----- Cargo.toml | 10 +++++----- src/invoke.rs | 20 +++++++++----------- src/serve.rs | 2 +- 4 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a42acf7c..a326c7e62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1210,7 +1210,7 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "0.0.3" -source = "git+https://github.com/stellar/rs-soroban-env?rev=7395b810#7395b8108b7eae28a2a068a0f3b75a5f824ee515" +source = "git+https://github.com/stellar/rs-soroban-env?rev=09dbeaaa#09dbeaaaf3b87e0fdea48315c53bf28ea04b6817" dependencies = [ "soroban-env-macros", "soroban-wasmi", @@ -1221,7 +1221,7 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "0.0.3" -source = "git+https://github.com/stellar/rs-soroban-env?rev=7395b810#7395b8108b7eae28a2a068a0f3b75a5f824ee515" +source = "git+https://github.com/stellar/rs-soroban-env?rev=09dbeaaa#09dbeaaaf3b87e0fdea48315c53bf28ea04b6817" dependencies = [ "backtrace", "dyn-fmt", @@ -1245,7 +1245,7 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "0.0.3" -source = "git+https://github.com/stellar/rs-soroban-env?rev=7395b810#7395b8108b7eae28a2a068a0f3b75a5f824ee515" +source = "git+https://github.com/stellar/rs-soroban-env?rev=09dbeaaa#09dbeaaaf3b87e0fdea48315c53bf28ea04b6817" dependencies = [ "itertools", "proc-macro2", @@ -1257,7 +1257,7 @@ dependencies = [ [[package]] name = "soroban-native-sdk-macros" version = "0.0.1" -source = "git+https://github.com/stellar/rs-soroban-env?rev=7395b810#7395b8108b7eae28a2a068a0f3b75a5f824ee515" +source = "git+https://github.com/stellar/rs-soroban-env?rev=09dbeaaa#09dbeaaaf3b87e0fdea48315c53bf28ea04b6817" dependencies = [ "itertools", "proc-macro2", @@ -1333,7 +1333,7 @@ dependencies = [ [[package]] name = "stellar-xdr" version = "0.0.1" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=f4fe3091#f4fe309136070c3d932bfcb8019ded953b842e5c" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=61de11d#61de11d0ce5eb8a6e722d903af2abfadb5f5bd0e" dependencies = [ "serde", ] diff --git a/Cargo.toml b/Cargo.toml index d0cb4b26b..2a898c7a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,8 +29,8 @@ prettyplease = "0.1.18" syn = { version = "1.0.99", features = ["parsing"] } [patch.crates-io] -soroban-env-common = { git = "https://github.com/stellar/rs-soroban-env", rev = "7395b810" } -soroban-env-host = { git = "https://github.com/stellar/rs-soroban-env", rev = "7395b810" } -soroban-env-macros = { git = "https://github.com/stellar/rs-soroban-env", rev = "7395b810" } -soroban-native-sdk-macros = { git = "https://github.com/stellar/rs-soroban-env", rev = "7395b810" } -stellar-xdr = { git = "https://github.com/stellar/rs-stellar-xdr", rev = "f4fe3091" } +soroban-env-common = { git = "https://github.com/stellar/rs-soroban-env", rev = "09dbeaaa" } +soroban-env-host = { git = "https://github.com/stellar/rs-soroban-env", rev = "09dbeaaa" } +soroban-env-macros = { git = "https://github.com/stellar/rs-soroban-env", rev = "09dbeaaa" } +soroban-native-sdk-macros = { git = "https://github.com/stellar/rs-soroban-env", rev = "09dbeaaa" } +stellar-xdr = { git = "https://github.com/stellar/rs-stellar-xdr", rev = "61de11d" } diff --git a/src/invoke.rs b/src/invoke.rs index d39161dc4..2ddbe230d 100644 --- a/src/invoke.rs +++ b/src/invoke.rs @@ -122,22 +122,20 @@ impl Cmd { let res = h.invoke_function(HostFunction::Call, complete_args.try_into()?)?; println!("{}", strval::to_string(&res)?); - if self.cost { - h.get_budget(|b| { - eprintln!("Cpu Insns: {}", b.cpu_insns.get_count()); - eprintln!("Mem Bytes: {}", b.mem_bytes.get_count()); - for cost_type in CostType::variants() { - eprintln!("Cost ({:?}): {}", cost_type, b.get_input(*cost_type)); - } - }); - } - - let storage = h.recover_storage().map_err(|_h| { + let (storage, budget, _) = h.try_finish().map_err(|_h| { HostError::from(ScStatus::HostStorageError( ScHostStorageErrorCode::UnknownError, )) })?; + if self.cost { + eprintln!("Cpu Insns: {}", budget.cpu_insns.get_count()); + eprintln!("Mem Bytes: {}", budget.mem_bytes.get_count()); + for cost_type in CostType::variants() { + eprintln!("Cost ({:?}): {}", cost_type, budget.get_input(*cost_type)); + } + } + snapshot::commit(ledger_entries, Some(&storage.map), &self.ledger_file)?; Ok(()) } diff --git a/src/serve.rs b/src/serve.rs index 19ef0c81b..fc0e10dc1 100644 --- a/src/serve.rs +++ b/src/serve.rs @@ -228,7 +228,7 @@ fn invoke( // Some(v) // }); - let storage = h.recover_storage().map_err(|_h| { + let (storage, _, _) = h.try_finish().map_err(|_h| { HostError::from(ScStatus::HostStorageError( ScHostStorageErrorCode::UnknownError, ))