Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sim-only deprecation notice #1634

Merged
merged 9 commits into from
Oct 10, 2024
28 changes: 14 additions & 14 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Deploy builtin Soroban Asset Contract
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout



Expand Down Expand Up @@ -371,7 +371,7 @@ If no keys are specified the contract itself is extended.
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout



Expand Down Expand Up @@ -399,7 +399,7 @@ Deploy a wasm contract
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `-i`, `--ignore-checks` — Whether to ignore safety checks when deploying contracts

Default value: `false`
Expand Down Expand Up @@ -675,7 +675,7 @@ Install a WASM file to the ledger without creating a contract instance
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--wasm <WASM>` — Path to wasm binary
* `-i`, `--ignore-checks` — Whether to ignore safety checks when deploying contracts

Expand Down Expand Up @@ -714,7 +714,7 @@ stellar contract invoke ... -- --help
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--send <SEND>` — Whether or not to send a transaction

Default value: `default`
Expand Down Expand Up @@ -828,7 +828,7 @@ If no keys are specificed the contract itself is restored.
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout



Expand Down Expand Up @@ -1393,7 +1393,7 @@ Transfers the XLM balance of an account to another account and removes the sourc
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand All @@ -1419,7 +1419,7 @@ Bumps forward the sequence number of the source account to the given sequence nu
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand All @@ -1445,7 +1445,7 @@ Creates, updates, or deletes a trustline Learn more about trustlines https://dev
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down Expand Up @@ -1474,7 +1474,7 @@ Creates and funds a new account with the specified starting balance
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down Expand Up @@ -1503,7 +1503,7 @@ Sets, modifies, or deletes a data entry (name/value pair) that is attached to an
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand All @@ -1530,7 +1530,7 @@ Sends an amount in a specific asset to a destination account
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down Expand Up @@ -1560,7 +1560,7 @@ Set option for an account such as flags, inflation destination, signers, home do
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down Expand Up @@ -1601,7 +1601,7 @@ Allows issuing account to configure authorization and trustline flags to an asse
* `--cost` — Output the cost execution to stderr
* `--instructions <INSTRUCTIONS>` — Number of instructions to simulate
* `--build-only` — Build the transaction and only write the base64 xdr to stdout
* `--sim-only` — Simulate the transaction and only write the base64 xdr to stdout
* `--sim-only` — (Deprecated) simulate the transaction and only write the base64 xdr to stdout
* `--rpc-url <RPC_URL>` — RPC server endpoint
* `--network-passphrase <NETWORK_PASSPHRASE>` — Network passphrase to sign the transaction sent to the rpc server
* `--network <NETWORK>` — Name of network to use from config
Expand Down
17 changes: 14 additions & 3 deletions cmd/soroban-cli/src/fee.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
use clap::arg;
use clap::builder::TypedValueParser;

use crate::assembled::Assembled;
use soroban_env_host::xdr;

use crate::commands::HEADING_RPC;
use crate::{commands::HEADING_RPC, deprecated_arg};

const DEPRECATION_MESSAGE: &str = "--sim-only is deprecated and will be removed \
in the future versions of CLI. The same functionality is offered by `tx simulate` command. To \
replicate the behaviour, you can run `stellar <command> --build only | stellar tx simulate`";
leighmcculloch marked this conversation as resolved.
Show resolved Hide resolved

#[derive(Debug, clap::Args, Clone)]
#[group(skip)]
Expand All @@ -20,8 +25,14 @@ pub struct Args {
/// Build the transaction and only write the base64 xdr to stdout
#[arg(long, help_heading = HEADING_RPC)]
pub build_only: bool,
/// Simulate the transaction and only write the base64 xdr to stdout
#[arg(long, help_heading = HEADING_RPC, conflicts_with = "build_only")]
/// (Deprecated) simulate the transaction and only write the base64 xdr to stdout
#[arg(
long,
help_heading = HEADING_RPC,
conflicts_with = "build_only",
display_order = 100,
value_parser = deprecated_arg!(bool, DEPRECATION_MESSAGE))
]
pub sim_only: bool,
}

Expand Down
20 changes: 20 additions & 0 deletions cmd/soroban-cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,26 @@ pub mod http {
}
}

pub mod args {
/// Mark argument as deprecated with warning to be printed when it's used. Note: marco is only
/// supported for `bool` and `String` and is required to add
/// ```
/// use clap::builder::TypedValueParser;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which function call requires this type? We can instead reference the type using the generic as syntax.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed 3e143cf that removes the need for the use. Have a look at the syntax.

/// ```
/// When using the marco
#[macro_export]
macro_rules! deprecated_arg {
(bool, $message: expr) => {
clap::builder::BoolValueParser::new().map(|x| {
if (x) {
$crate::print::Print::new(false).warnln($message);
}
x
})
};
}
}

pub mod rpc {
use soroban_env_host::xdr;
use soroban_rpc::{Client, Error};
Expand Down
Loading