Skip to content

Commit

Permalink
Bump version to 0.3.0 (#291)
Browse files Browse the repository at this point in the history
* Bump version to 0.3.0

* Bump soroban-rpc version to 0.3.0

* Don't publish soroban-tools

* Remove soroban-tools

* Remove soroban-tools

* fix build.rs

* fix build.rs

* undo changing version that should be injected during build

* Bugfixes for e2e tests in release/v0.3.0 branch (#294)

* Fix account sequence numbers when deploy --wasm-hash

Fixes #290
Fixes regression introduced in eadacec

* Fix conflicting contract ids in e2e tests

* Stop hard-coding salts in e2e tests to make them more robust

This also means they are now independent, and do not need a clean
network to run.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Paul Bellamy <[email protected]>
Co-authored-by: Leigh McCulloch <[email protected]>
  • Loading branch information
4 people authored Dec 6, 2022
1 parent 36a0dd2 commit 46e72d8
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 119 deletions.
38 changes: 3 additions & 35 deletions Cargo.lock

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

51 changes: 1 addition & 50 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,54 +1,5 @@
[package]
name = "soroban-tools"
description = "Soroban Tools"
homepage = "https://github.com/stellar/soroban-cli"
repository = "https://github.com/stellar/soroban-cli"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
version = "0.2.1"
edition = "2021"
rust-version = "1.65"
autobins = false
build = "build.rs"

[build-dependencies]
crate-git-revision = "0.0.4"

[[bin]]
name = "soroban"
path = "cmd/soroban-cli/src/main.rs"

[dependencies]
soroban-env-host = { workspace = true, features = ["vm", "serde", "hostfn_log_fmt_values"] }
soroban-spec = { workspace = true }
soroban-token-spec = { workspace = true }
stellar-strkey = { workspace = true }
clap = { version = "3.1.18", features = ["derive", "env"] }
base64 = "0.13.0"
thiserror = "1.0.31"
serde = "1.0.82"
serde_derive = "1.0.82"
serde_json = "1.0.82"
hex = "0.4.3"
tokio = { version = "1", features = ["full"] }
warp = "0.3"
clap_complete = "3.2.3"
rand = "0.8.5"
wasmparser = "0.90.0"
sha2 = "0.10.6"
csv = "1.1.6"
ed25519-dalek = "1.0.1"
jsonrpsee-http-client = "0.15.1"
jsonrpsee-core = "0.15.1"
regex = "1.6.0"
wasm-opt = "0.110.1"

[dev_dependencies]
assert_cmd = "2.0.4"
assert_fs = "1.0.7"

[workspace]
resolver = "2"
members = [
"cmd/soroban-cli",
"cmd/soroban-cli/tests/fixtures/test-wasms/hello_world",
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test: build-test-wasms
cargo test --workspace

e2e-test:
cargo test --test 'e2e*' -- --ignored
cargo test --test it -- --ignored

check: Cargo.lock
cargo clippy --all-targets
Expand Down
3 changes: 1 addition & 2 deletions cmd/soroban-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@ repository = "https://github.com/stellar/soroban-cli"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
readme = "README.md"
version = "0.1.2"
version = "0.3.0"
edition = "2021"
rust-version = "1.64"
autobins = false
build = "../../build.rs"

[[bin]]
name = "soroban"
Expand Down
File renamed without changes.
8 changes: 5 additions & 3 deletions cmd/soroban-cli/src/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,13 +211,13 @@ impl Cmd {
// Get the account sequence number
let public_strkey =
stellar_strkey::StrkeyPublicKeyEd25519(key.public.to_bytes()).to_string();
let account_details = client.get_account(&public_strkey).await?;
// TODO: create a cmdline parameter for the fee instead of simply using the minimum fee
let fee: u32 = 100;
let sequence = account_details.sequence.parse::<i64>()?;

let wasm_hash = match contract_src {
ContractSource::Wasm(wasm) => {
let account_details = client.get_account(&public_strkey).await?;
let sequence = account_details.sequence.parse::<i64>()?;
let (tx, hash) = build_install_contract_code_tx(
wasm,
sequence + 1,
Expand All @@ -231,9 +231,11 @@ impl Cmd {
ContractSource::WasmHash(wasm_hash) => Hash(wasm_hash),
};

let account_details = client.get_account(&public_strkey).await?;
let sequence = account_details.sequence.parse::<i64>()?;
let (tx, contract_id) = build_create_contract_tx(
wasm_hash,
sequence + 2,
sequence + 1,
fee,
self.network_passphrase.as_ref().unwrap(),
salt,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_hello_world"
version = "0.2.1"
version = "0.3.0"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test_invoker_account_exists"
version = "0.2.1"
version = "0.3.0"
authors = ["Stellar Development Foundation <[email protected]>"]
license = "Apache-2.0"
edition = "2021"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
use crate::util::{test_wasm, SorobanCommand, Standalone};
use std::str;

// e2e tests are ignore by default
#[test]
#[ignore]
fn e2e_deploy_and_invoke_contract_against_rpc_server() {
// This test assumes a fresh standalone network rpc server on port 8000

Standalone::new_cmd()
let result = &Standalone::new_cmd()
.arg("deploy")
.arg("--wasm")
.arg(test_wasm("test_hello_world"))
.arg("--salt=0")
.assert()
.stdout("b392cd0044315873f32307bfd535a9cbbb0402a57133ff7283afcae66be8174b\n")
.stderr("success\nsuccess\n")
.success();

let id = str::from_utf8(&result.get_output().stdout).unwrap().trim();

Standalone::new_cmd()
.arg("invoke")
.arg("--id=b392cd0044315873f32307bfd535a9cbbb0402a57133ff7283afcae66be8174b")
.arg("--id")
.arg(id)
.arg("--fn=hello")
.arg("--arg=world")
.assert()
Expand All @@ -32,27 +34,34 @@ fn e2e_deploy_and_invoke_contract_against_rpc_server() {
#[ignore]
fn e2e_install_deploy_and_invoke_contract_against_rpc_server() {
// This test assumes a fresh standalone network rpc server on port 8000
Standalone::new_cmd()
let install_result = Standalone::new_cmd()
.arg("install")
.arg("--wasm")
.arg(test_wasm("test_hello_world"))
.assert()
.stdout("86270dcca8dd4e7131c89dcc61223f096d7a1fa4a1d90c39dd6542b562369ecc\n")
.stderr("success\n")
.success();

Standalone::new_cmd()
let wasm_hash = str::from_utf8(&install_result.get_output().stdout)
.unwrap()
.trim();

let deploy_result = &Standalone::new_cmd()
.arg("deploy")
.arg("--wasm-hash=86270dcca8dd4e7131c89dcc61223f096d7a1fa4a1d90c39dd6542b562369ecc")
.arg("--salt=0")
.arg("--wasm-hash")
.arg(wasm_hash)
.assert()
.stdout("b392cd0044315873f32307bfd535a9cbbb0402a57133ff7283afcae66be8174b\n")
.stderr("success\n")
.success();

let id = str::from_utf8(&deploy_result.get_output().stdout)
.unwrap()
.trim();

Standalone::new_cmd()
.arg("invoke")
.arg("--id=b392cd0044315873f32307bfd535a9cbbb0402a57133ff7283afcae66be8174b")
.arg("--id")
.arg(id)
.arg("--fn=hello")
.arg("--arg=world")
.assert()
Expand All @@ -66,25 +75,19 @@ fn e2e_install_deploy_and_invoke_contract_against_rpc_server() {
fn create_and_invoke_token_contract_against_rpc_server() {
// This test assumes a fresh standalone network rpc server on port 8000

Standalone::new_cmd()
.args([
"token",
"create",
"--name=Stellar Lumens",
"--symbol=XLM",
"--salt=1",
])
let result = Standalone::new_cmd()
.args(["token", "create", "--name=Stellar Lumens", "--symbol=XLM"])
.assert()
.stdout("1bd2a2473623e73904d35a334476d1fe3cd192811bd823b7815fd9ce57c82232\n")
.stderr("success\nsuccess\n")
.success();

let id = str::from_utf8(&result.get_output().stdout).unwrap().trim();

Standalone::new_cmd()
.args([
"invoke",
"--id=1bd2a2473623e73904d35a334476d1fe3cd192811bd823b7815fd9ce57c82232",
"--fn=symbol",
])
.arg("invoke")
.arg("--id")
.arg(id)
.arg("--fn=symbol")
.assert()
.stdout("[88,76,77]\n")
.stderr("success\n")
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/it/util.rs → cmd/soroban-cli/tests/it/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use assert_cmd::Command;
use assert_fs::{prelude::PathChild, TempDir};

pub fn test_wasm(name: &str) -> PathBuf {
let mut path = PathBuf::from("target/wasm32-unknown-unknown/test-wasms").join(name);
let mut path = PathBuf::from("../../target/wasm32-unknown-unknown/test-wasms").join(name);
path.set_extension("wasm");
assert!(path.is_file(), "File not found: {}. run 'make test-wasms' to generate .wasm files before running this test", path.display());
path
Expand Down

0 comments on commit 46e72d8

Please sign in to comment.