Skip to content

Commit

Permalink
Revert "[Epic] Separating soroban-rpc to prepare for repo change (#1174
Browse files Browse the repository at this point in the history
…)" (#1193)

This reverts commit 2581f62.
  • Loading branch information
2opremio authored and psheth9 committed Feb 7, 2024
1 parent 51d85ee commit 8cceef3
Show file tree
Hide file tree
Showing 27 changed files with 180 additions and 691 deletions.
28 changes: 3 additions & 25 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,49 +69,27 @@ version = "=20.3.1"
version = "20.3.0"
path = "cmd/soroban-cli"

[workspace.dependencies.soroban-rpc]
version = "20.2.0"
path = "cmd/crates/soroban-rpc"

[workspace.dependencies.stellar-xdr]
version = "=20.1.0"
default-features = true

[workspace.dependencies]
stellar-strkey = "0.0.7"
sep5 = "0.0.2"
base64 = "0.21.2"
thiserror = "1.0.46"
sha2 = "0.10.7"
ethnum = "1.3.2"
hex = "0.4.3"
itertools = "0.10.0"

serde-aux = "4.1.2"
sep5 = "0.0.2"
serde_json = "1.0.82"
serde = "1.0.82"

clap = { version = "4.1.8", features = [
"derive",
"env",
"deprecated",
"string",
] }
clap_complete = "4.1.4"
stellar-strkey = "0.0.7"
tracing = "0.1.37"
tracing-subscriber = "0.3.16"
tracing-appender = "0.2.2"
which = "4.4.0"
wasmparser = "0.90.0"
termcolor = "1.1.3"
termcolor_output = "1.0.1"
ed25519-dalek = "2.0.0"

# networking
http = "1.0.0"
jsonrpsee-http-client = "0.20.1"
jsonrpsee-core = "0.20.1"
tokio = "1.28.1"


# [patch."https://github.com/stellar/rs-soroban-env"]
# soroban-env-host = { path = "../rs-soroban-env/soroban-env-host/" }
Expand Down
51 changes: 0 additions & 51 deletions cmd/crates/soroban-rpc/Cargo.toml

This file was deleted.

3 changes: 0 additions & 3 deletions cmd/crates/soroban-rpc/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions cmd/crates/soroban-rpc/src/log.rs

This file was deleted.

11 changes: 0 additions & 11 deletions cmd/crates/soroban-rpc/src/log/diagnostic_events.rs

This file was deleted.

2 changes: 0 additions & 2 deletions cmd/crates/soroban-spec-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ crate-type = ["rlib"]
soroban-spec = { workspace = true }
stellar-strkey = { workspace = true }
stellar-xdr = { workspace = true, features = ["curr", "std", "serde"] }
soroban-env-host = { workspace = true }

serde_json = { workspace = true }
itertools = { workspace = true }
ethnum = { workspace = true }
Expand Down
1 change: 0 additions & 1 deletion cmd/crates/soroban-spec-tools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ use stellar_xdr::curr::{
UInt128Parts, UInt256Parts, Uint256, VecM,
};

pub mod contract;
pub mod utils;

#[derive(thiserror::Error, Debug)]
Expand Down
4 changes: 2 additions & 2 deletions cmd/crates/soroban-test/tests/it/help.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
use soroban_cli::commands::contract;
use soroban_test::TestEnv;

use crate::util::{invoke_custom as invoke, CUSTOM_TYPES, DEFAULT_CONTRACT_ID};
use crate::util::{invoke_custom as invoke, CUSTOM_TYPES};

async fn invoke_custom(func: &str, args: &str) -> Result<String, contract::invoke::Error> {
let e = &TestEnv::default();
invoke(e, DEFAULT_CONTRACT_ID, func, args, &CUSTOM_TYPES.path()).await
invoke(e, "1", func, args, &CUSTOM_TYPES.path()).await
}

#[tokio::test]
Expand Down
7 changes: 2 additions & 5 deletions cmd/crates/soroban-test/tests/it/integration/dotenv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn current_env_not_overwritten() {
write_env_file(e, &contract_id());

e.new_assert_cmd("contract")
.env("SOROBAN_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4")
.env("SOROBAN_CONTRACT_ID", "2")
.arg("invoke")
.arg("--")
.arg("hello")
Expand All @@ -51,10 +51,7 @@ fn cli_args_have_priority() {
deploy_hello(e);
write_env_file(e, &contract_id());
e.new_assert_cmd("contract")
.env(
"SOROBAN_CONTRACT_ID",
"CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4",
)
.env("SOROBAN_CONTRACT_ID", "2")
.arg("invoke")
.arg("--id")
.arg(TEST_CONTRACT_ID)
Expand Down
18 changes: 0 additions & 18 deletions cmd/crates/soroban-test/tests/it/integration/hello_world.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use predicates::boolean::PredicateBooleanExt;
use soroban_cli::commands::{
contract::{self, fetch},
keys,
Expand All @@ -20,23 +19,7 @@ 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")
.arg("--id")
.arg(id)
.assert()
.stdout(predicates::str::contains(id))
.success();
invoke_hello_world_with_lib_two(sandbox, id).await;
invoke_auth(sandbox, id);
invoke_auth_with_identity(sandbox, id).await;
Expand All @@ -56,7 +39,6 @@ fn invoke_hello_world(sandbox: &TestEnv, id: &str) {
sandbox
.new_assert_cmd("contract")
.arg("invoke")
.arg("--is-view")
.arg("--id")
.arg(id)
.arg("--")
Expand Down
2 changes: 0 additions & 2 deletions cmd/crates/soroban-test/tests/it/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,3 @@ pub async fn invoke_custom(
i.invoke(&soroban_cli::commands::global::Args::default())
.await
}

pub const DEFAULT_CONTRACT_ID: &str = "CDR6QKTWZQYW6YUJ7UP7XXZRLWQPFRV6SWBLQS4ZQOSAF4BOUD77OO5Z";
16 changes: 9 additions & 7 deletions cmd/soroban-cli/src/commands/contract/bindings/typescript.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use std::{ffi::OsString, fmt::Debug, path::PathBuf};

use clap::{command, Parser};
use soroban_spec_tools::contract as contract_spec;
use soroban_spec_typescript::{self as typescript, boilerplate::Project};

use crate::commands::{
config::locator,
contract::{self, fetch},
network::{self, Network},
};
use crate::wasm;
use crate::{
commands::{
config::locator,
contract::{self, fetch},
network::{self, Network},
},
utils::contract_spec::{self, ContractSpec},
};

#[derive(Parser, Debug, Clone)]
#[group(skip)]
Expand Down Expand Up @@ -76,7 +78,7 @@ impl Cmd {
network: self.network.clone(),
};
let bytes = fetch.get_bytes().await?;
contract_spec::Spec::new(&bytes)?.spec
ContractSpec::new(&bytes)?.spec
};
if self.output_dir.is_file() {
return Err(Error::IsFile(self.output_dir.clone()));
Expand Down
9 changes: 3 additions & 6 deletions cmd/soroban-cli/src/commands/contract/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,15 @@ impl Cmd {
}),
};

let res = client
let (result, meta, events) = client
.prepare_and_send_transaction(&tx, &key, &[], &network.network_passphrase, None, None)
.await?;

let events = res.events()?;
tracing::trace!(?result);
tracing::trace!(?meta);
if !events.is_empty() {
tracing::info!("Events:\n {events:#?}");
}
let meta = res
.result_meta
.as_ref()
.ok_or(Error::MissingOperationResult)?;

// The transaction from core will succeed regardless of whether it actually found & extended
// the entry, so we have to inspect the result meta to tell if it worked or not.
Expand Down
3 changes: 1 addition & 2 deletions cmd/soroban-cli/src/commands/contract/inspect.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use clap::{command, Parser};
use soroban_env_host::xdr;
use soroban_spec_tools::contract;
use std::{fmt::Debug, path::PathBuf};
use tracing::debug;

Expand Down Expand Up @@ -29,7 +28,7 @@ pub enum Error {
#[error(transparent)]
Xdr(#[from] xdr::Error),
#[error(transparent)]
Spec(#[from] contract::Error),
Spec(#[from] crate::utils::contract_spec::Error),
}

impl Cmd {
Expand Down
16 changes: 9 additions & 7 deletions cmd/soroban-cli/src/commands/contract/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ impl Cmd {
build_install_contract_code_tx(contract, sequence + 1, self.fee.fee, &key)?;

// Currently internal errors are not returned if the contract code is expired
if let Some(TransactionResult {
result: TransactionResultResult::TxInternalError,
..
}) = client
if let (
TransactionResult {
result: TransactionResultResult::TxInternalError,
..
},
_,
_,
) = client
.prepare_and_send_transaction(
&tx_without_preflight,
&key,
Expand All @@ -125,8 +129,6 @@ impl Cmd {
None,
)
.await?
.result
.as_ref()
{
// Now just need to restore it and don't have to install again
restore::Cmd {
Expand All @@ -151,7 +153,7 @@ impl Cmd {
}
}

fn get_contract_meta_sdk_version(wasm_spec: &soroban_spec_tools::contract::Spec) -> Option<String> {
fn get_contract_meta_sdk_version(wasm_spec: &utils::contract_spec::ContractSpec) -> Option<String> {
let rs_sdk_version_option = if let Some(_meta) = &wasm_spec.meta_base64 {
wasm_spec.meta.iter().find(|entry| match entry {
ScMetaEntry::ScMetaV0(ScMetaV0 { key, .. }) => {
Expand Down
Loading

0 comments on commit 8cceef3

Please sign in to comment.