Skip to content

Commit

Permalink
fix: deploy contract directly and remove fee args
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Feb 16, 2024
1 parent 2a6da4a commit 0b0a6a5
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bindings-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion cmd/crates/soroban-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 0 additions & 4 deletions cmd/crates/soroban-test/tests/it/integration/dotenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}");
Expand All @@ -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")
Expand All @@ -37,7 +34,6 @@ fn current_env_not_overwritten() {
"SOROBAN_CONTRACT_ID",
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4",
)
.env("SOROBAN_FEE", SOROBAN_FEE)
.arg("invoke")
.arg("--")
.arg("hello")
Expand Down
10 changes: 7 additions & 3 deletions cmd/crates/soroban-test/tests/it/integration/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
14 changes: 1 addition & 13 deletions cmd/crates/soroban-test/tests/it/integration/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 0b0a6a5

Please sign in to comment.