diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b6c7892159..7cc5c98f1f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,7 +20,7 @@ To run tests scripts, you have to install: - [asdf](https://asdf-vm.com/guide/getting-started.html) - [starknet-devnet](https://0xspaceshard.github.io/starknet-devnet/docs/intro) -> ⚠️ Make sure you run `./scripts/prepare-for-tests.sh` after setting up the development environment, otherwise the +> ⚠️ Make sure you run `./scripts/prepare_for_tests.sh` after setting up the development environment, otherwise the > tests will fail. Before creating a contribution, make sure your code passes the following checks diff --git a/README.md b/README.md index 8d42a83baa..cdd0c5e00b 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,23 @@ Starknet Foundry, like its [Ethereum counterpart](https://github.com/foundry-rs/ - [Cast](https://github.com/foundry-rs/starknet-foundry/tree/master/starknet-foundry/crates/cast): All-in-one tool for interacting with Starknet smart contracts, sending transactions and getting chain data. +## Installation + +To install Starknet Foundry, run: + +```shell +$ curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/install.sh | sh +``` + +You can also specify a version you wish to install: + +```shell +$ curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/install.sh | sh -s -- -v 0.1.0 +``` + +To verify that the Starknet Foundry is installed correctly, run `snforge --version` and `sncast --version`. + + ## Features - Fast testing framework `Forge` written in Rust @@ -67,4 +84,4 @@ Starknet Foundry is under active development, and we appreciate any help from th the [contribution guidelines](./CONTRIBUTING.md). Check out [development guide](https://foundry-rs.github.io/starknet-foundry/development/environment-setup.html) for -local environment setup guide. \ No newline at end of file +local environment setup guide. diff --git a/benchmarks/benchmark.py b/benchmarks/benchmark.py index 037f5f44b9..264895e9ed 100644 --- a/benchmarks/benchmark.py +++ b/benchmarks/benchmark.py @@ -10,7 +10,7 @@ TOOLCHAINS = [ # name, command, cairo version ("protostar", ["protostar", "test"], 1), - ("forge", ["forge"], 2), + ("forge", ["snforge"], 2), ("cairo_test", ["scarb", "cairo-test"], 2), ] diff --git a/docs/book.toml b/docs/book.toml index 974d4f0088..c9d64f518c 100644 --- a/docs/book.toml +++ b/docs/book.toml @@ -1,5 +1,5 @@ [book] -authors = ["Starknet-Foundry"] +authors = ["Starknet Foundry"] language = "en" multilingual = false src = "src" diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md index 4d74402646..985dad82f7 100644 --- a/docs/src/SUMMARY.md +++ b/docs/src/SUMMARY.md @@ -10,7 +10,6 @@ # Projects -* [Project Templates](projects/template.md) * [Project Configuration](projects/configuration.md) # Forge overview diff --git a/docs/src/development/environment-setup.md b/docs/src/development/environment-setup.md index 243702c9af..bb634ee09e 100644 --- a/docs/src/development/environment-setup.md +++ b/docs/src/development/environment-setup.md @@ -24,7 +24,7 @@ It is not possible to run tests without these installed. ## Running Tests -> ⚠️ Make sure you run `./scripts/prepare-for-tests.sh` after setting up the development environment, otherwise the +> ⚠️ Make sure you run `./scripts/prepare_for_tests.sh` after setting up the development environment, otherwise the > tests will fail. Tests can be run with: diff --git a/docs/src/getting-started/first-steps.md b/docs/src/getting-started/first-steps.md index c562ea8622..be94314b32 100644 --- a/docs/src/getting-started/first-steps.md +++ b/docs/src/getting-started/first-steps.md @@ -1,9 +1,9 @@ -# First Steps With Starknet-Foundry +# First Steps With Starknet Foundry -In this section we provide an overview of Starknet-Foundry `forge` command line tool. We demonstrate how to create a -new project, compile, and test it. +In this section we provide an overview of Starknet Foundry `forge` command line tool. +We demonstrate how to create a new project, compile, and test it. -To start a new project with Starknet-Foundry, clone the template repository +To start a new project with Starknet Foundry, clone the template repository ```shell $ git clone https://github.com/foundry-rs/starknet_forge_template.git @@ -30,7 +30,7 @@ $ tree . -L 1 And run tests with `forge` ```shell -$ forge +$ snforge Collected 2 test(s) and 2 test file(s) Running 0 test(s) from src/lib.cairo Running 2 test(s) from tests/test_contract.cairo diff --git a/docs/src/getting-started/installation.md b/docs/src/getting-started/installation.md index 0ff19f7af8..6fd5077d19 100644 --- a/docs/src/getting-started/installation.md +++ b/docs/src/getting-started/installation.md @@ -7,8 +7,18 @@ To use Starknet Foundry, you need [Scarb](https://docs.swmansion.com/scarb/docs/ You can find what version of Scarb is compatible with your version of Starknet Foundry in [release notes](https://github.com/foundry-rs/starknet-foundry/releases). ### Install via installation script +1. Open a terminal and run the following command: +```shell +$ curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/install.sh | sh +``` +2. To verify that the Starknet Foundry is installed correctly, run `snforge --version` and `sncast --version`. +In some cases, you may need to close and reopen the terminal. -TODO: https://github.com/foundry-rs/starknet-foundry/pull/115 +You can also specify a version you wish to install: + +```shell +$ curl -L https://raw.githubusercontent.com/foundry-rs/starknet-foundry/master/install.sh | sh -s -- -v 0.1.0 +``` ## How to build Starknet Foundry from source code If you are unable to install Starknet Foundry using the instructions above, you can try building it from the [source code](https://github.com/foundry-rs/starknet-foundry) as follows: diff --git a/docs/src/projects/configuration.md b/docs/src/projects/configuration.md index f6790834fa..3ad788961c 100644 --- a/docs/src/projects/configuration.md +++ b/docs/src/projects/configuration.md @@ -47,7 +47,7 @@ defined in the profile. > the rest of them using CLI flags. You can also override parameters from the configuration using CLI flags. ```shell -$ cast --profile myprofile \ +$ sncast --profile myprofile \ call \ --contract-address 0x38b7b9507ccf73d79cb42c2cc4e58cf3af1248f342112879bfdf5aa4f606cc9 \ --function get \ @@ -78,7 +78,7 @@ url = "http://127.0.0.1:5050/rpc" That way, you can omit passing `--profile` parameter: ```shell -$ cast call \ +$ sncast call \ --contract-address 0x38b7b9507ccf73d79cb42c2cc4e58cf3af1248f342112879bfdf5aa4f606cc9 \ --function get \ --calldata 0x0 \ diff --git a/docs/src/projects/template.md b/docs/src/projects/template.md deleted file mode 100644 index e19a4d14f3..0000000000 --- a/docs/src/projects/template.md +++ /dev/null @@ -1 +0,0 @@ -# Project Templates diff --git a/docs/src/starknet/call.md b/docs/src/starknet/call.md index 3ece464dba..b9e2dbf6bf 100644 --- a/docs/src/starknet/call.md +++ b/docs/src/starknet/call.md @@ -2,7 +2,7 @@ ## Overview -Starknet Foundry cast supports calling smart contracts on a given network with the `cast call` command. +Starknet Foundry cast supports calling smart contracts on a given network with the `sncast call` command. The basic inputs that you need for this command are: @@ -17,7 +17,7 @@ For a detailed CLI description, see the [call command reference](../appendix/cas ### With [profiles](../projects/configuration.md#Cast) ```shell -$ cast call \ +$ sncast call \ --profile testnet \ --contract-address 0x4a739ab73aa3cac01f9da5d55f49fb67baee4919224454a2e3f85b16462a911 \ --function some_function \ @@ -30,7 +30,7 @@ response: [FieldElement { inner: 0x000000000000000000000000000000000000000000000 ### Without profiles ```shell -$ cast \ +$ sncast \ --rpc_url http://127.0.0.1:5050 \ --network testnet \ call \ diff --git a/docs/src/starknet/declare.md b/docs/src/starknet/declare.md index 87bfcae0cb..debbbd833e 100644 --- a/docs/src/starknet/declare.md +++ b/docs/src/starknet/declare.md @@ -16,7 +16,7 @@ First make sure that you have created a [`Scarb.toml`](../projects/template.md) Then run: ```shell -$ cast --account myuser \ +$ sncast --account myuser \ --network testnet \ --url http://127.0.0.1:5050/rpc \ declare \ diff --git a/docs/src/starknet/deploy.md b/docs/src/starknet/deploy.md index 59a45494a0..a01160d10e 100644 --- a/docs/src/starknet/deploy.md +++ b/docs/src/starknet/deploy.md @@ -2,7 +2,7 @@ ## Overview -Starknet Foundry cast supports deploying smart contracts to a given network with the `cast deploy` command. +Starknet Foundry cast supports deploying smart contracts to a given network with the `sncast deploy` command. It works by invoking a [Universal Deployer Contract](https://docs.openzeppelin.com/contracts-cairo/0.6.1/udc), which deploys the contract with the given class hash and constructor arguments. @@ -13,7 +13,7 @@ For detailed CLI description, see [deploy command reference](../appendix/cast/de After [declaring your contract](./declare.md), you can deploy it the following way: ```shell -$ cast deploy --class-hash 0x8448a68b5ea1affc45e3fd4b8b480ea36a51dc34e337a16d2567d32d0c6f8a +$ sncast deploy --class-hash 0x8448a68b5ea1affc45e3fd4b8b480ea36a51dc34e337a16d2567d32d0c6f8a command: Deploy contract_address: 0x301316d47a81b39c5e27cca4a7b8ca4773edbf1103218588d6da4d3ed53035a transaction_hash: 0x64a62a000240e034d1862c2bbfa154aac6a8195b4b2e570f38bf4fd47a5ab1e diff --git a/docs/src/starknet/index.md b/docs/src/starknet/index.md index 53f0274545..cf09f3178a 100644 --- a/docs/src/starknet/index.md +++ b/docs/src/starknet/index.md @@ -7,9 +7,9 @@ Starknet Foundry `cast` is a command line tool for performing Starknet RPC calls ## How to use cast -To use cast, run the cast command followed by a subcommand (see [available commands](../appendix/cast.md)): +To use cast, run the `sncast` command followed by a subcommand (see [available commands](../appendix/cast.md)): ```shell -$ cast +$ sncast ``` If `Scarb.toml` is present and configured with `[tool.cast]`, `url`, `network` and `account` name will be taken from it. You can, however, overwrite their values by supplying them as flags directly to `cast` cli. @@ -22,7 +22,7 @@ If `Scarb.toml` is present and configured with `[tool.cast]`, `url`, `network` a Let's use `cast` to call a contract's function: ```shell -$ cast --account myotheruser \ +$ sncast --account myotheruser \ --network testnet \ --url http://127.0.0.1:5050/rpc \ call \ diff --git a/docs/src/starknet/invoke.md b/docs/src/starknet/invoke.md index b60c1f63ff..d2676ceaa0 100644 --- a/docs/src/starknet/invoke.md +++ b/docs/src/starknet/invoke.md @@ -2,9 +2,9 @@ ## Overview -Starknet Foundry cast supports invoking smart contracts on a given network with the `cast invoke` command. +Starknet Foundry cast supports invoking smart contracts on a given network with the `sncast invoke` command. -In most cases you have to provide: +In most cases, you have to provide: - Contract address - Function name @@ -17,7 +17,7 @@ For detailed CLI description, see [invoke command reference](../appendix/cast/in ### Without profiles ```shell -$ cast \ +$ sncast \ --rpc_url http://127.0.0.1:5050 \ --network testnet \ --account example_user \ @@ -34,7 +34,7 @@ $ cast \ ### With [profiles](../projects/configuration.md#Cast) ```shell -$ cast invoke \ +$ sncast invoke \ --profile testnet \ --contract-address 0x4a739ab73aa3cac01f9da5d55f49fb67baee4919224454a2e3f85b16462a911 \ --function "some_function" \ diff --git a/docs/src/testing/contracts.md b/docs/src/testing/contracts.md index 0618898d3f..5737e2fe48 100644 --- a/docs/src/testing/contracts.md +++ b/docs/src/testing/contracts.md @@ -69,7 +69,7 @@ fn call_and_invoke() { ``` ```shell -$ forge +$ snforge Collected 1 test(s) and 1 test file(s) Running 1 test(s) from src/lib.cairo [PASS] using_dispatchers::using_dispatchers::call_and_invoke @@ -112,7 +112,7 @@ fn failing() { ``` ```shell -$ forge +$ snforge Collected 1 test(s) and 1 test file(s) Running 1 test(s) from src/lib.cairo [FAIL] src::failing @@ -147,7 +147,7 @@ fn handling_errors() { Now the test passes as expected. ```shell -$ forge +$ snforge Collected 1 test(s) and 1 test file(s) Running 1 test(s) from src/lib.cairo [PASS] src::handling_errors diff --git a/docs/src/testing/debugging.md b/docs/src/testing/debugging.md index 84f565fbd4..23c9632a12 100644 --- a/docs/src/testing/debugging.md +++ b/docs/src/testing/debugging.md @@ -33,7 +33,7 @@ fn test_print() { Running tests will include prints in the output: ```shell -$ forge +$ snforge Collected 1 test(s) and 2 test file(s) Running 0 test(s) from src/lib.cairo Running 1 test(s) from tests/test_print.cairo diff --git a/docs/src/testing/testing.md b/docs/src/testing/testing.md index 984ea91175..868270c4da 100644 --- a/docs/src/testing/testing.md +++ b/docs/src/testing/testing.md @@ -21,10 +21,10 @@ fn test_sum() { It is a common practice to keep your unit tests in the same file as the tested code. If you prefer, you can also put test code in a separate file anywhere in the project directory. -Now run forge using command: +Now run forge using a command: ```shell -$ forge +$ snforge Collected 1 test(s) and 1 test file(s) Running 1 test(s) from src/lib.cairo [PASS] src::test_sum @@ -57,7 +57,7 @@ fn failing() { ``` ```shell -$ forge +$ snforge Collected 1 test(s) and 1 test file(s) Running 1 test(s) from src/lib.cairo [FAIL] src::failing diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000000..c20ba46e4d --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,490 @@ +#!/bin/sh +# shellcheck shell=dash +# shellcheck disable=SC2039 + +# This is just a little script that can be downloaded from the internet to install Starknet Foundry. +# It just does platform detection, downloads the release archive, extracts it and tries to make +# the `snforge` and `sncast` binaries available in $PATH in least invasive way possible. +# +# It runs on Unix shells like {a,ba,da,k,z}sh. It uses the common `local` extension. +# Note: Most shells limit `local` to 1 var per line, contra bash. +# +# Most of this code is based on/copy-pasted from rustup and protostar installers. + +set -u + +REPO="https://github.com/foundry-rs/starknet-foundry" +XDG_DATA_HOME="${XDG_DATA_HOME:-"${HOME}/.local/share"}" +INSTALL_ROOT="${XDG_DATA_HOME}/starknet-foundry-install" +LOCAL_BIN="${HOME}/.local/bin" +LOCAL_BIN_ESCAPED="\$HOME/.local/bin" + +usage() { + cat <&2 + exit 1 +} + +need_cmd() { + if ! check_cmd "$1"; then + err "need '$1' (command not found)" + fi +} + +check_cmd() { + command -v "$1" >/dev/null 2>&1 +} + +assert_nz() { + if [ -z "$1" ]; then err "assert_nz $2"; fi +} + +# Run a command that should never fail. +# If the command fails execution will immediately terminate with an error showing the failing command. +ensure() { + if ! "$@"; then err "command failed: $*"; fi +} + +# This is just for indicating that commands' results are being intentionally ignored. +# Usually, because it's being executed as part of error handling. +ignore() { + "$@" +} + +# This function has been copied verbatim from rustup install script. +get_architecture() { + local _ostype _cputype _bitness _arch _clibtype + _ostype="$(uname -s)" + _cputype="$(uname -m)" + _clibtype="gnu" + + if [ "$_ostype" = Linux ]; then + if [ "$(uname -o)" = Android ]; then + _ostype=Android + fi + if ldd --_requested_version 2>&1 | grep -q 'musl'; then + _clibtype="musl" + fi + fi + + if [ "$_ostype" = Darwin ] && [ "$_cputype" = i386 ]; then + # Darwin `uname -m` lies + if sysctl hw.optional.x86_64 | grep -q ': 1'; then + _cputype=x86_64 + fi + fi + + if [ "$_ostype" = SunOS ]; then + # Both Solaris and illumos presently announce as "SunOS" in "uname -s" + # so use "uname -o" to disambiguate. We use the full path to the + # system uname in case the user has coreutils uname first in PATH, + # which has historically sometimes printed the wrong value here. + if [ "$(/usr/bin/uname -o)" = illumos ]; then + _ostype=illumos + fi + + # illumos systems have multi-arch userlands, and "uname -m" reports the + # machine hardware name; e.g., "i86pc" on both 32- and 64-bit x86 + # systems. Check for the native (widest) instruction set on the + # running kernel: + if [ "$_cputype" = i86pc ]; then + _cputype="$(isainfo -n)" + fi + fi + + case "$_ostype" in + Android) + _ostype=linux-android + ;; + + Linux) + check_proc + _ostype=unknown-linux-$_clibtype + _bitness=$(get_bitness) + ;; + + FreeBSD) + _ostype=unknown-freebsd + ;; + + NetBSD) + _ostype=unknown-netbsd + ;; + + DragonFly) + _ostype=unknown-dragonfly + ;; + + Darwin) + _ostype=apple-darwin + ;; + + illumos) + _ostype=unknown-illumos + ;; + + MINGW* | MSYS* | CYGWIN* | Windows_NT) + _ostype=pc-windows-gnu + ;; + + *) + err "unrecognized OS type: $_ostype" + ;; + esac + + case "$_cputype" in + i386 | i486 | i686 | i786 | x86) + _cputype=i686 + ;; + + xscale | arm) + _cputype=arm + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + fi + ;; + + armv6l) + _cputype=arm + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + + armv7l | armv8l) + _cputype=armv7 + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + + aarch64 | arm64) + _cputype=aarch64 + ;; + + x86_64 | x86-64 | x64 | amd64) + _cputype=x86_64 + ;; + + mips) + _cputype=$(get_endianness mips '' el) + ;; + + mips64) + if [ "$_bitness" -eq 64 ]; then + # only n64 ABI is supported for now + _ostype="${_ostype}abi64" + _cputype=$(get_endianness mips64 '' el) + fi + ;; + + ppc) + _cputype=powerpc + ;; + + ppc64) + _cputype=powerpc64 + ;; + + ppc64le) + _cputype=powerpc64le + ;; + + s390x) + _cputype=s390x + ;; + riscv64) + _cputype=riscv64gc + ;; + loongarch64) + _cputype=loongarch64 + ;; + *) + err "unknown CPU type: $_cputype" + ;; + esac + + # Detect 64-bit linux with 32-bit userland + if [ "${_ostype}" = unknown-linux-gnu ] && [ "${_bitness}" -eq 32 ]; then + case $_cputype in + x86_64) + if [ -n "${RUSTUP_CPUTYPE:-}" ]; then + _cputype="$RUSTUP_CPUTYPE" + else { + # 32-bit executable for amd64 = x32 + if is_host_amd64_elf; then + err "x86_64 linux with x86 userland unsupported" + else + _cputype=i686 + fi + }; fi + ;; + mips64) + _cputype=$(get_endianness mips '' el) + ;; + powerpc64) + _cputype=powerpc + ;; + aarch64) + _cputype=armv7 + if [ "$_ostype" = "linux-android" ]; then + _ostype=linux-androideabi + else + _ostype="${_ostype}eabihf" + fi + ;; + riscv64gc) + err "riscv64 with 32-bit userland unsupported" + ;; + esac + fi + + # Detect armv7 but without the CPU features Rust needs in that build, + # and fall back to arm. + # See https://github.com/rust-lang/rustup.rs/issues/587. + if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then + if ensure grep '^Features' /proc/cpuinfo | grep -q -v neon; then + # At least one processor does not have NEON. + _cputype=arm + fi + fi + + _arch="${_cputype}-${_ostype}" + + RETVAL="$_arch" +} + +resolve_version() { + local _requested_version=$1 + local _requested_ref=$2 + + local _response + + say "retrieving $_requested_version version from ${REPO}..." + _response=$(ensure curl -Ls -H 'Accept: application/json' "${REPO}/releases/${_requested_ref}") + if [ "{\"error\":\"Not Found\"}" = "$_response" ]; then + err "version $_requested_version not found" + fi + + RETVAL=$(echo "$_response" | sed -e 's/.*"tag_name":"\([^"]*\)".*/\1/') +} + +create_install_dir() { + local _requested_version=$1 + + local _installdir="${INSTALL_ROOT}/${_requested_version}" + + if [ -d "$_installdir" ]; then + ensure rm -rf "$_installdir" + say "removed existing forge and cast installation at ${_installdir}" + fi + + ensure mkdir -p "$_installdir" + + RETVAL=$_installdir +} + +download() { + local _resolved_version=$1 + local _arch=$2 + local _installdir=$3 + local _tempdir=$4 + + local _tarball="starknet-foundry-${_resolved_version}-${_arch}.tar.gz" + local _url="${REPO}/releases/download/${_resolved_version}/${_tarball}" + local _dl="$_tempdir/starknet-foundry.tar.gz" + + say "downloading ${_tarball}..." + + ensure curl -fLS -o "$_dl" "$_url" + ensure tar -xz -C "$_installdir" --strip-components=1 -f "$_dl" +} + +create_symlinks() { + for binary in "snforge" "sncast"; do + local _binary="${_installdir}/bin/${binary}" + local _symlink="${LOCAL_BIN}/${binary}" + + ensure mkdir -p "$LOCAL_BIN" + ensure ln -fs "$_binary" "$_symlink" + ensure chmod u+x "$_symlink" + say "created symlink ${_symlink} -> ${_binary}" + done +} + +add_local_bin_to_path() { + local _profile + local _pref_shell + case ${SHELL:-""} in + */zsh) + _profile=$HOME/.zshrc + _pref_shell=zsh + ;; + */ash) + _profile=$HOME/.profile + _pref_shell=ash + ;; + */bash) + _profile=$HOME/.bashrc + _pref_shell=bash + ;; + */fish) + _profile=$HOME/.config/fish/config.fish + _pref_shell=fish + ;; + *) + err "could not detect shell, manually add '${LOCAL_BIN_ESCAPED}' to your PATH." + ;; + esac + + echo >>"$_profile" && echo "export PATH=\"\$PATH:${LOCAL_BIN_ESCAPED}\"" >>"$_profile" + echo \ + "Detected your preferred shell is ${_pref_shell} and added '${LOCAL_BIN_ESCAPED}' to PATH." \ + "Run 'source ${_profile}' or start a new terminal session to use Starknet Foundry." +} + +main "$@" || exit 1 diff --git a/starknet-foundry/Cargo.lock b/starknet-foundry/Cargo.lock index 0d5985e05f..d0a7a93414 100644 --- a/starknet-foundry/Cargo.lock +++ b/starknet-foundry/Cargo.lock @@ -5178,9 +5178,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" +checksum = "0d2d1d55045829d65aad9d389139882ad623b33b904e7c9f1b10c5b8927298e5" dependencies = [ "thiserror", "ucd-trie", diff --git a/starknet-foundry/crates/cast/Cargo.toml b/starknet-foundry/crates/cast/Cargo.toml index f9ccf237d7..2ae895a960 100644 --- a/starknet-foundry/crates/cast/Cargo.toml +++ b/starknet-foundry/crates/cast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "cast" -description = "Cast - a starknet-foundry CLI client" +description = "Cast - a Starknet Foundry CLI client" version = "0.0.1" edition = "2021" @@ -31,3 +31,7 @@ url = "2.4.0" reqwest = "0.11.18" test-case = "3.1.0" fs_extra = "1.3.0" + +[[bin]] +name = "sncast" +path = "src/main.rs" diff --git a/starknet-foundry/crates/cast/src/main.rs b/starknet-foundry/crates/cast/src/main.rs index 19815412fe..73b0fd1437 100644 --- a/starknet-foundry/crates/cast/src/main.rs +++ b/starknet-foundry/crates/cast/src/main.rs @@ -12,7 +12,7 @@ mod starknet_commands; #[derive(Parser)] #[command(version)] -#[command(about = "cast - a starknet-foundry CLI", long_about = None)] +#[command(about = "Cast - a Starknet Foundry CLI", long_about = None)] struct Cli { /// Profile name in Scarb.toml config file #[clap(short, long)] diff --git a/starknet-foundry/crates/cast/tests/e2e/declare.rs b/starknet-foundry/crates/cast/tests/e2e/declare.rs index 87c436731d..96a915183f 100644 --- a/starknet-foundry/crates/cast/tests/e2e/declare.rs +++ b/starknet-foundry/crates/cast/tests/e2e/declare.rs @@ -33,7 +33,7 @@ async fn test_happy_case(contract_path: &str, salt: &str, account: &str) { "999999999999", ]; - let snapbox = Command::new(cargo_bin!("cast")) + let snapbox = Command::new(cargo_bin!("sncast")) .current_dir(&contract_path) .args(args); let output = snapbox.assert().success().get_output().stdout.clone(); @@ -62,7 +62,7 @@ async fn contract_already_declared() { "Map", ]; - let snapbox = Command::new(cargo_bin!("cast")) + let snapbox = Command::new(cargo_bin!("sncast")) .current_dir(CONTRACTS_DIR.to_string() + "/v1/map") .args(args); @@ -87,7 +87,7 @@ async fn wrong_contract_name_passed() { "nonexistent", ]; - let snapbox = Command::new(cargo_bin!("cast")) + let snapbox = Command::new(cargo_bin!("sncast")) .current_dir(CONTRACTS_DIR.to_string() + "/v1/map") .args(args); @@ -115,7 +115,7 @@ fn scarb_build_fails(contract_path: &str, accounts_file_path: &str) { "BuildFails", ]; - let snapbox = Command::new(cargo_bin!("cast")) + let snapbox = Command::new(cargo_bin!("sncast")) .current_dir(CONTRACTS_DIR.to_string() + contract_path) .args(args); @@ -146,7 +146,7 @@ fn test_too_low_max_fee(contract_path: &str, salt: &str, account: &str) { "1", ]; - let snapbox = Command::new(cargo_bin!("cast")) + let snapbox = Command::new(cargo_bin!("sncast")) .current_dir(&contract_path) .args(args); diff --git a/starknet-foundry/crates/cast/tests/helpers/runner.rs b/starknet-foundry/crates/cast/tests/helpers/runner.rs index 134407549f..81cb53fad8 100644 --- a/starknet-foundry/crates/cast/tests/helpers/runner.rs +++ b/starknet-foundry/crates/cast/tests/helpers/runner.rs @@ -2,6 +2,6 @@ use snapbox::cmd::{cargo_bin, Command}; #[must_use] pub fn runner(args: &[&str]) -> Command { - let command = Command::new(cargo_bin!("cast")).args(args); + let command = Command::new(cargo_bin!("sncast")).args(args); command } diff --git a/starknet-foundry/crates/forge/Cargo.toml b/starknet-foundry/crates/forge/Cargo.toml index 23bf23d962..9f5f962140 100644 --- a/starknet-foundry/crates/forge/Cargo.toml +++ b/starknet-foundry/crates/forge/Cargo.toml @@ -52,3 +52,7 @@ which = "4.4.0" [lib] name = "forge" + +[[bin]] +name = "snforge" +path = "src/main.rs" diff --git a/starknet-foundry/crates/forge/tests/e2e/common/runner.rs b/starknet-foundry/crates/forge/tests/e2e/common/runner.rs index dc5ce6973f..189c67fb5b 100644 --- a/starknet-foundry/crates/forge/tests/e2e/common/runner.rs +++ b/starknet-foundry/crates/forge/tests/e2e/common/runner.rs @@ -1,6 +1,6 @@ use snapbox::cmd::{cargo_bin, Command as SnapboxCommand}; pub fn runner() -> SnapboxCommand { - let snapbox = SnapboxCommand::new(cargo_bin!("forge")); + let snapbox = SnapboxCommand::new(cargo_bin!("snforge")); snapbox }