From 4ef52d0b1e77a29b7120f0278b5700e995bce946 Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 31 Jan 2024 11:03:50 -0500 Subject: [PATCH] fix: switch to --is-view so e2e tests will pass and no breaking changes --- .../tests/it/integration/hello_world.rs | 14 +++++++++++--- cmd/soroban-cli/src/commands/contract/invoke.rs | 6 +++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs index b881110082..26f10c3eb3 100644 --- a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs +++ b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs @@ -1,3 +1,4 @@ +use predicates::boolean::PredicateBooleanExt; use soroban_cli::commands::{ contract::{self, fetch}, keys, @@ -19,6 +20,15 @@ async fn invoke() { extend_contract(sandbox, id, HELLO_WORLD).await; // Note that all functions tested here have no state invoke_hello_world(sandbox, id); + sandbox + .new_assert_cmd("events") + .arg("--start-ledger=20") + .arg("--id") + .arg(id) + .assert() + .stdout(predicates::str::contains(id).not()) + .success(); + invoke_hello_world_with_lib(sandbox, id).await; sandbox .new_assert_cmd("events") .arg("--start-ledger=20") @@ -27,8 +37,6 @@ async fn invoke() { .assert() .stdout(predicates::str::contains(id)) .success(); - - invoke_hello_world_with_lib(sandbox, id).await; invoke_hello_world_with_lib_two(sandbox, id).await; invoke_auth(sandbox, id); invoke_auth_with_identity(sandbox, id).await; @@ -48,7 +56,7 @@ fn invoke_hello_world(sandbox: &TestEnv, id: &str) { sandbox .new_assert_cmd("contract") .arg("invoke") - .arg("--sign") + .arg("--is-view") .arg("--id") .arg(id) .arg("--") diff --git a/cmd/soroban-cli/src/commands/contract/invoke.rs b/cmd/soroban-cli/src/commands/contract/invoke.rs index 9f3fc39e7b..2eb8ee3b7e 100644 --- a/cmd/soroban-cli/src/commands/contract/invoke.rs +++ b/cmd/soroban-cli/src/commands/contract/invoke.rs @@ -47,9 +47,9 @@ pub struct Cmd { /// Number of instructions to simulate #[arg(long)] pub instructions: Option, - /// Sign and submit transaction regardless of whether it's a view function + /// Do not sign and submit transaction #[arg(long, env = "SOROBAN_INVOKE_SIGN", env = "SYSTEM_TEST_VERBOSE_OUTPUT")] - pub sign: bool, + pub is_view: bool, /// Function name as subcommand, then arguments for that function as `--arg-name value` #[arg(last = true, id = "CONTRACT_FN_AND_ARGS")] pub slop: Vec, @@ -304,7 +304,7 @@ impl Cmd { if let Some(instructions) = self.instructions { txn = txn.set_max_instructions(instructions); } - let (return_value, events) = if txn.is_view() && !self.sign { + let (return_value, events) = if self.is_view { ( txn.sim_res().results()?[0].xdr.clone(), txn.sim_res().events()?,