From 0b0a6a5d8aa5a38c1b8c6d673f4b53f34fc1848a Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Fri, 16 Feb 2024 15:28:18 -0500 Subject: [PATCH] fix: deploy contract directly and remove fee args --- .github/workflows/bindings-ts.yml | 2 +- cmd/crates/soroban-test/src/lib.rs | 1 - .../soroban-test/tests/it/integration/dotenv.rs | 4 ---- .../tests/it/integration/hello_world.rs | 10 +++++++--- .../soroban-test/tests/it/integration/util.rs | 14 +------------- 5 files changed, 9 insertions(+), 22 deletions(-) diff --git a/.github/workflows/bindings-ts.yml b/.github/workflows/bindings-ts.yml index b092e549c..7a85e0e11 100644 --- a/.github/workflows/bindings-ts.yml +++ b/.github/workflows/bindings-ts.yml @@ -38,6 +38,6 @@ jobs: - run: cargo build - run: rustup target add wasm32-unknown-unknown - run: make build-test-wasms - - run: SOROBAN_PORT=8000 SOROBAN_FEE=1000000 cargo test --features it --package soroban-test --test it -- integration + - run: SOROBAN_PORT=8000 cargo test --features it --package soroban-test --test it -- integration - run: npm ci && npm run test working-directory: cmd/crates/soroban-spec-typescript/ts-tests diff --git a/cmd/crates/soroban-test/src/lib.rs b/cmd/crates/soroban-test/src/lib.rs index a0763977d..9ac884193 100644 --- a/cmd/crates/soroban-test/src/lib.rs +++ b/cmd/crates/soroban-test/src/lib.rs @@ -127,7 +127,6 @@ impl TestEnv { .env("SOROBAN_RPC_URL", &self.rpc_url) .env("SOROBAN_NETWORK_PASSPHRASE", LOCAL_NETWORK_PASSPHRASE) .env("XDG_CONFIG_HOME", self.temp_dir.as_os_str()) - .env("SOROBAN_FEE", "1000000") .current_dir(&self.temp_dir); cmd } diff --git a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs index d3ddd140d..e15cdd656 100644 --- a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs +++ b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs @@ -2,8 +2,6 @@ use soroban_test::TestEnv; use super::util::deploy_hello; -const SOROBAN_FEE: &str = "100"; - fn write_env_file(e: &TestEnv, contents: &str) { let env_file = e.dir().join(".env"); let contents = format!("SOROBAN_CONTRACT_ID={contents}"); @@ -17,7 +15,6 @@ fn can_read_file() { let id = deploy_hello(e); write_env_file(e, &id); e.new_assert_cmd("contract") - .env("SOROBAN_FEE", SOROBAN_FEE) .arg("invoke") .arg("--") .arg("hello") @@ -37,7 +34,6 @@ fn current_env_not_overwritten() { "SOROBAN_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", ) - .env("SOROBAN_FEE", SOROBAN_FEE) .arg("invoke") .arg("--") .arg("hello") 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 2a946e9eb..f8c66b929 100644 --- a/cmd/crates/soroban-test/tests/it/integration/hello_world.rs +++ b/cmd/crates/soroban-test/tests/it/integration/hello_world.rs @@ -3,6 +3,7 @@ use soroban_cli::commands::{ config::{locator, secret}, contract::{self, fetch}, }; +use soroban_rpc::GetLatestLedgerResponse; use soroban_test::{AssertExt, TestEnv, LOCAL_NETWORK_PASSPHRASE}; use crate::integration::util::extend_contract; @@ -12,7 +13,8 @@ use super::util::{deploy_hello, extend}; #[tokio::test] async fn invoke() { let sandbox = &TestEnv::new(); - + let c = soroban_rpc::Client::new(&sandbox.rpc_url).unwrap(); + let GetLatestLedgerResponse { sequence, .. } = c.get_latest_ledger().await.unwrap(); sandbox .new_assert_cmd("keys") .arg("fund") @@ -63,9 +65,11 @@ async fn invoke() { extend_contract(sandbox, id).await; // Note that all functions tested here have no state invoke_hello_world(sandbox, id); - sandbox + + sandbox .new_assert_cmd("events") - .arg("--start-ledger=20") + .arg("--start-ledger") + .arg(&sequence.to_string()) .arg("--id") .arg(id) .assert() diff --git a/cmd/crates/soroban-test/tests/it/integration/util.rs b/cmd/crates/soroban-test/tests/it/integration/util.rs index 996af270c..e9d771a7f 100644 --- a/cmd/crates/soroban-test/tests/it/integration/util.rs +++ b/cmd/crates/soroban-test/tests/it/integration/util.rs @@ -28,23 +28,11 @@ pub fn deploy_custom(sandbox: &TestEnv) -> String { } pub fn deploy_contract(sandbox: &TestEnv, wasm: &Wasm) -> String { - let hash = wasm.hash().unwrap(); sandbox .new_assert_cmd("contract") - .env("SOROBAN_FEE", "100000") - .arg("install") + .arg("deploy") .arg("--wasm") .arg(wasm.path()) - .arg("--ignore-checks") - .assert() - .success() - .stdout(format!("{hash}\n")); - - sandbox - .new_assert_cmd("contract") - .arg("deploy") - .arg("--wasm-hash") - .arg(&format!("{hash}")) .arg("--salt") .arg(TEST_SALT) .arg("--ignore-checks")