Skip to content

Commit

Permalink
Merge branch 'main' into docker-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
satyamz authored Nov 21, 2023
2 parents a1ed18b + c560bdd commit fd6e836
Show file tree
Hide file tree
Showing 30 changed files with 701 additions and 305 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest-4-cores
env:
# the gh tag of system-test repo version to run
SYSTEM_TEST_GIT_REF: 352cc1d4ea96af8cfb2c2b7335c3b51da000f889
SYSTEM_TEST_GIT_REF: master

# the soroban tools source code to compile and run from system test
# refers to checked out source of current git hub ref context
Expand All @@ -32,16 +32,16 @@ jobs:
# test runtime environment, tests invoke rustc/cargo
SYSTEM_TEST_RUST_TOOLCHAIN_VERSION: stable

# set the version of js-soroban-client to use, need to choose one of either
# set the version of js-stellar-sdk to use, need to choose one of either
# resolution options, using npm release or a gh ref:
#
# option #1, set the version of soroban-js-client based on a npm release version
SYSTEM_TEST_JS_SOROBAN_CLIENT_NPM_VERSION: 1.0.0-beta.2
# option #2, set the version of soroban-js-client used as a ref to a gh repo
# if a value is set on SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REPO, it takes precedence
# over any SYSTEM_TEST_JS_SOROBAN_CLIENT_NPM_VERSION
SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REPO:
SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REF:
# option #1, set the version of stellar-sdk based on a npm release version
SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION: v11.0.0-beta.6
# option #2, set the version of stellar-sdk used as a ref to a gh repo if
# a value is set on SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO, it takes
# precedence over any SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION
SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO:
SYSTEM_TEST_JS_STELLAR_SDK_GH_REF:

# system test will build quickstart image internally to use for running the service stack
# configured in standalone network mode(core, rpc)
Expand All @@ -64,25 +64,25 @@ jobs:
name: checkout soroban-tools
with:
path: soroban-tools
- if: ${{ env.SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REPO != ''}}
name: prepare local js-soroban-client
- if: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO != ''}}
name: prepare local js-stellar-sdk
run: |
rm -rf $GITHUB_WORKSPACE/system-test/js-soroban-client;
- if: ${{ env.SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REPO != ''}}
rm -rf $GITHUB_WORKSPACE/system-test/js-stellar-sdk;
- if: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO != ''}}
uses: actions/checkout@v3
with:
repository: ${{ env.SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REPO }}
ref: ${{ env.SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REF }}
path: system-test/js-soroban-client
repository: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO }}
ref: ${{ env.SYSTEM_TEST_JS_STELLAR_SDK_GH_REF }}
path: system-test/js-stellar-sdk
- uses: stellar/actions/rust-cache@main
- name: Build system test with component versions
run: |
cd $GITHUB_WORKSPACE/system-test
if [ -z "$SYSTEM_TEST_JS_SOROBAN_CLIENT_GH_REPO" ]; then \
JS_SOROBAN_CLIENT_REF="$SYSTEM_TEST_JS_SOROBAN_CLIENT_NPM_VERSION"; \
if [ -z "$SYSTEM_TEST_JS_STELLAR_SDK_GH_REPO" ]; then \
JS_STELLAR_SDK_REF="$SYSTEM_TEST_JS_STELLAR_SDK_NPM_VERSION"; \
else \
JS_SOROBAN_CLIENT_REF="file:/home/tester/js-soroban-client"; \
fi
JS_STELLAR_SDK_REF="file:/home/tester/js-stellar-sdk"; \
fi
make \
CORE_GIT_REF=$SYSTEM_TEST_CORE_GIT_REF \
CORE_COMPILE_CONFIGURE_FLAGS="$SYSTEM_TEST_CORE_COMPILE_CONFIGURE_FLAGS" \
Expand All @@ -91,7 +91,7 @@ jobs:
SOROBAN_CLI_GIT_REF=$SYSTEM_TEST_SOROBAN_TOOLS_REF \
RUST_TOOLCHAIN_VERSION=$SYSTEM_TEST_RUST_TOOLCHAIN_VERSION \
QUICKSTART_GIT_REF=$SYSTEM_TEST_QUICKSTART_GIT_REF \
JS_SOROBAN_CLIENT_NPM_VERSION=$JS_SOROBAN_CLIENT_REF \
JS_STELLAR_SDK_NPM_VERSION=$JS_STELLAR_SDK_REF \
build
- name: Run system test scenarios
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/soroban-rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ jobs:
env:
SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true
SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core
PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.14.1-1529.fcbbad4ce.focal
PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.14.1-1553.f4c4e2fca.focal
steps:
- uses: actions/checkout@v3
with:
Expand Down
43 changes: 22 additions & 21 deletions Cargo.lock

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

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ version = "20.0.0-rc4"
[workspace.dependencies.soroban-env-host]
version = "20.0.0-rc2"
git = "https://github.com/stellar/rs-soroban-env"
rev = "91f44778389490ad863d61a8a90ac9875ba6d8fd"
rev = "2674d867d7c6aa4212abab05ff30e5804ff1db90"

[workspace.dependencies.soroban-spec]
version = "20.0.0-rc2"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "729ed3ac5fe8600a3245d5816eadd3c95ab2eb54"
rev = "fb422beae0d4944dc0e83559a8940b31f5ebd89d"
# path = "../rs-soroban-sdk/soroban-spec"

[workspace.dependencies.soroban-spec-rust]
version = "20.0.0-rc2"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "729ed3ac5fe8600a3245d5816eadd3c95ab2eb54"
rev = "fb422beae0d4944dc0e83559a8940b31f5ebd89d"
# path = "../rs-soroban-sdk/soroban-spec-rust"

[workspace.dependencies.soroban-spec-json]
Expand All @@ -45,12 +45,12 @@ path = "./cmd/crates/soroban-spec-tools"
[workspace.dependencies.soroban-sdk]
version = "20.0.0-rc2"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "729ed3ac5fe8600a3245d5816eadd3c95ab2eb54"
rev = "fb422beae0d4944dc0e83559a8940b31f5ebd89d"

[workspace.dependencies.soroban-ledger-snapshot]
version = "20.0.0-rc2"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "729ed3ac5fe8600a3245d5816eadd3c95ab2eb54"
rev = "fb422beae0d4944dc0e83559a8940b31f5ebd89d"

[workspace.dependencies.soroban-cli]
version = "20.0.0-rc4"
Expand Down
6 changes: 3 additions & 3 deletions cmd/crates/soroban-spec-typescript/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,12 @@ pub fn entry_to_ts(entry: &Entry) -> String {
output = format!(r#"return {output};"#);
};
let parse_result_xdr = if return_type == "void" {
r#"parseResultXdr: () => {}"#.to_owned()
r"parseResultXdr: () => {}".to_owned()
} else {
format!(
r#"parseResultXdr: (xdr): {return_type} => {{
r"parseResultXdr: (xdr): {return_type} => {{
{output}
}}"#
}}"
)
};
let js_name = jsify_name(name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"dependencies": {
"@stellar/freighter-api": "1.5.1",
"buffer": "6.0.3",
"soroban-client": "1.0.0-beta.2"
"soroban-client": "1.0.0-beta.3"
},
"scripts": {
"build": "node ./scripts/build.mjs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {

export type Tx = Transaction<Memo<MemoType>, Operation[]>;

export class SendFailedError extends Error { }
/**
* Get account details from the Soroban network for the publicKey currently
* selected in Freighter. If not connected to Freighter, return null.
Expand Down Expand Up @@ -82,7 +83,7 @@ export async function invoke<R extends ResponseTypes, T = string>({
contractId,
wallet,
}: InvokeArgs<R, T>): Promise<T | string | SomeRpcResponse> {
wallet = wallet ?? (await import("@stellar/freighter-api"));
wallet = wallet ?? (await import("@stellar/freighter-api")).default;
let parse = parseResultXdr;
const server = new SorobanClient.Server(rpcUrl, {
allowHttp: rpcUrl.startsWith("http://"),
Expand Down Expand Up @@ -162,7 +163,11 @@ export async function invoke<R extends ResponseTypes, T = string>({
if ("returnValue" in raw) return parse(raw.returnValue!);

// otherwise, it returned the result of `sendTransaction`
if ("errorResultXdr" in raw) return parse(raw.errorResultXdr!);
if ("errorResult" in raw) {
throw new SendFailedError(
`errorResult.result(): ${JSON.stringify(raw.errorResult?.result())}`
)
}

// if neither of these are present, something went wrong
console.error("Don't know how to parse result! Returning full RPC response.");
Expand Down
10 changes: 5 additions & 5 deletions cmd/crates/soroban-test/tests/it/arg_parsing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ fn parse_i256() {

#[test]
fn parse_bytes() {
let b = from_string_primitive(r#"beefface"#, &ScSpecTypeDef::Bytes).unwrap();
let b = from_string_primitive(r"beefface", &ScSpecTypeDef::Bytes).unwrap();
assert_eq!(
b,
ScVal::Bytes(ScBytes(vec![0xbe, 0xef, 0xfa, 0xce].try_into().unwrap()))
Expand All @@ -100,7 +100,7 @@ fn parse_bytes() {

#[test]
fn parse_bytes_when_hex_is_all_numbers() {
let b = from_string_primitive(r#"4554"#, &ScSpecTypeDef::Bytes).unwrap();
let b = from_string_primitive(r"4554", &ScSpecTypeDef::Bytes).unwrap();
assert_eq!(
b,
ScVal::Bytes(ScBytes(vec![0x45, 0x54].try_into().unwrap()))
Expand All @@ -111,7 +111,7 @@ fn parse_bytes_when_hex_is_all_numbers() {
#[test]
fn parse_bytesn() {
let b = from_string_primitive(
r#"beefface"#,
r"beefface",
&ScSpecTypeDef::BytesN(ScSpecTypeBytesN { n: 4 }),
)
.unwrap();
Expand All @@ -124,8 +124,8 @@ fn parse_bytesn() {

#[test]
fn parse_bytesn_when_hex_is_all_numbers() {
let b = from_string_primitive(r#"4554"#, &ScSpecTypeDef::BytesN(ScSpecTypeBytesN { n: 2 }))
.unwrap();
let b =
from_string_primitive(r"4554", &ScSpecTypeDef::BytesN(ScSpecTypeBytesN { n: 2 })).unwrap();
assert_eq!(
b,
ScVal::Bytes(ScBytes(vec![0x45, 0x54].try_into().unwrap()))
Expand Down
1 change: 1 addition & 0 deletions cmd/crates/soroban-test/tests/it/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ mod custom_types;
mod dotenv;
mod hello_world;
mod util;
mod wrap;
Loading

0 comments on commit fd6e836

Please sign in to comment.