diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 7eb6d4f63..dfa0c0c0b 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -99,7 +99,6 @@ - [`forge config`](./reference/cli/forge/config.md) - [`forge coverage`](./reference/cli/forge/coverage.md) - [`forge create`](./reference/cli/forge/create.md) - - [`forge debug`](./reference/cli/forge/debug.md) - [`forge doc`](./reference/cli/forge/doc.md) - [`forge eip712`](./reference/cli/forge/eip712.md) - [`forge flatten`](./reference/cli/forge/flatten.md) @@ -287,7 +286,6 @@ - [forge verify-check](./reference/forge/forge-verify-check.md) - [forge flatten](./reference/forge/forge-flatten.md) - [Utility Commands](./reference/forge/utility-commands.md) - - [forge debug](./reference/forge/forge-debug.md) - [forge bind](./reference/forge/forge-bind.md) - [forge cache](./reference/forge/forge-cache.md) - [forge cache clean](./reference/forge/forge-cache-clean.md) diff --git a/src/forge/debugger.md b/src/forge/debugger.md index 8f6ee34c9..da3b1a363 100644 --- a/src/forge/debugger.md +++ b/src/forge/debugger.md @@ -2,9 +2,9 @@ Forge ships with an interactive debugger. -The debugger is accessible on [`forge debug`](../reference/forge/forge-debug.md) and on [`forge test`](../reference/forge/forge-test.md). +The debugger is accessible on [`forge test`](../reference/forge/forge-test.md) and on [`forge script`](../reference/forge/forge-script.md). -Using `forge test`: +Using `forge test` (or `forge script`): ```sh $ forge test --debug $FUNC @@ -20,22 +20,6 @@ If you have multiple contracts with the same function name, you need to limit th If the matching test is a fuzz test, the debugger will open the first failing fuzz scenario, or the last successful one, whichever comes first. -Using `forge debug`: - -```sh -$ forge debug --debug $FILE --sig $FUNC -``` - -Where `$FILE` is the path to the contract you want to debug, and `$FUNC` is the signature of the function you want to debug. For example: - -```sh -$ forge debug --debug src/SomeContract.sol --sig "myFunc(uint256,string)" 123 "hello" -``` - -You can also specify raw calldata using `--sig` instead of a function signature. - -If your source file contains more than one contract, specify the contract you want to debug using the `--target-contract` flag. - ### Debugger layout ![An image of the debugger UI](../images/debugger.png) diff --git a/src/reference/cli/SUMMARY.md b/src/reference/cli/SUMMARY.md index 651f08f00..f25b07a24 100644 --- a/src/reference/cli/SUMMARY.md +++ b/src/reference/cli/SUMMARY.md @@ -13,7 +13,6 @@ - [`forge config`](./forge/config.md) - [`forge coverage`](./forge/coverage.md) - [`forge create`](./forge/create.md) - - [`forge debug`](./forge/debug.md) - [`forge doc`](./forge/doc.md) - [`forge eip712`](./forge/eip712.md) - [`forge flatten`](./forge/flatten.md) @@ -172,4 +171,3 @@ - [`chisel view`](./chisel/view.md) - [`chisel clear-cache`](./chisel/clear-cache.md) - [`chisel eval`](./chisel/eval.md) - diff --git a/src/reference/cli/forge/debug.md b/src/reference/cli/forge/debug.md deleted file mode 100644 index a799619ed..000000000 --- a/src/reference/cli/forge/debug.md +++ /dev/null @@ -1,345 +0,0 @@ -# forge debug - -Debugs a single smart contract as a script - -```bash -$ forge debug --help -``` - -```txt -Usage: forge debug [OPTIONS] [ARGS]... - -Arguments: - - The contract you want to run. Either the file path or contract name. - - If multiple contracts exist in the same file you must specify the - target contract with --target-contract. - - [ARGS]... - Arguments to pass to the script function - -Options: - --target-contract - The name of the contract you want to run - - [aliases: tc] - - -s, --sig - The signature of the function you want to call in the contract, or raw - calldata - - [default: run()] - - --debug - Open the script in the debugger - - --dump - File path to dump execution details as JSON - - -h, --help - Print help (see a summary with '-h') - - -j, --threads - Number of threads to use. Specifying 0 defaults to the number of - logical cores - - [aliases: jobs] - -Cache options: - --force - Clear the cache and artifacts folder and recompile - -Build options: - --no-cache - Disable the cache - - --eof - Use EOF-enabled solc binary. Enables via-ir and sets EVM version to - Prague. Requires Docker to be installed. - - Note that this is a temporary solution until the EOF support is merged - into the main solc release. - - --skip ... - Skip building files whose names contain the given filter. - - `test` and `script` are aliases for `.t.sol` and `.s.sol`. - -Linker options: - --libraries - Set pre-linked libraries - - [env: DAPP_LIBRARIES=] - -Compiler options: - --ignored-error-codes - Ignore solc warnings by error code - - --deny-warnings - Warnings will trigger a compiler error - - --no-auto-detect - Do not auto-detect the `solc` version - - --use - Specify the solc version, or a path to a local solc, to build with. - - Valid values are in the format `x.y.z`, `solc:x.y.z` or - `path/to/solc`. - - --offline - Do not access the network. - - Missing solc versions will not be installed. - - --via-ir - Use the Yul intermediate representation compilation pipeline - - --no-metadata - Do not append any metadata to the bytecode. - - This is equivalent to setting `bytecode_hash` to `none` and - `cbor_metadata` to `false`. - - --ast - Includes the AST as JSON in the compiler output - - --evm-version - The target EVM version - - --optimize [] - Activate the Solidity optimizer - - [possible values: true, false] - - --optimizer-runs - The number of runs specifies roughly how often each opcode of the - deployed code will be executed across the life-time of the contract. - This means it is a trade-off parameter between code size (deploy cost) - and code execution cost (cost after deployment). An `optimizer_runs` - parameter of `1` will produce short but expensive code. In contrast, a - larger `optimizer_runs` parameter will produce longer but more gas - efficient code - - --extra-output ... - Extra output to include in the contract's artifact. - - Example keys: evm.assembly, ewasm, ir, irOptimized, metadata - - For a full description, see - - - --extra-output-files ... - Extra output to write to separate files. - - Valid values: metadata, ir, irOptimized, ewasm, evm.assembly - -Project options: - -o, --out - The path to the contract artifacts folder - - --revert-strings - Revert string configuration. - - Possible values are "default", "strip" (remove), "debug" - (Solidity-generated revert strings) and "verboseDebug" - - --build-info - Generate build info files - - --build-info-path - Output path to directory that build info files will be written to - - --root - The project's root path. - - By default root of the Git repository, if in one, or the current - working directory. - - -C, --contracts - The contracts source directory - - -R, --remappings - The project's remappings - - --remappings-env - The project's remappings from the environment - - --cache-path - The path to the compiler cache - - --lib-paths - The path to the library folder - - --hardhat - Use the Hardhat-style project layout. - - This is the same as using: `--contracts contracts --lib-paths - node_modules`. - - [aliases: hh] - - --config-path - Path to the config file - -EVM options: - -f, --fork-url - Fetch state over a remote endpoint instead of starting from an empty - state. - - If you want to fetch state from a specific block number, see - --fork-block-number. - - [aliases: rpc-url] - - --fork-block-number - Fetch state from a specific block number over a remote endpoint. - - See --fork-url. - - --fork-retries - Number of retries. - - See --fork-url. - - --fork-retry-backoff - Initial retry backoff on encountering errors. - - See --fork-url. - - --no-storage-caching - Explicitly disables the use of RPC caching. - - All storage slots are read entirely from the endpoint. - - This flag overrides the project's configuration file. - - See --fork-url. - - --initial-balance - The initial balance of deployed test contracts - - --sender
- The address which will be executing tests/scripts - - --ffi - Enable the FFI cheatcode - - --always-use-create-2-factory - Use the create 2 factory in all cases including tests and - non-broadcasting scripts - - --create2-deployer
- The CREATE2 deployer address to use, this will override the one in the - config - -Fork config: - --compute-units-per-second - Sets the number of assumed available compute units per second for this - provider - - default value: 330 - - See also --fork-url and - - - --no-rpc-rate-limit - Disables rate limiting for this node's provider. - - See also --fork-url and - - - [aliases: no-rate-limit] - -Executor environment config: - --code-size-limit - EIP-170: Contract code size limit in bytes. Useful to increase this - because of tests. By default, it is 0x6000 (~25kb) - - --chain - The chain name or EIP-155 chain ID - - [aliases: chain-id] - - --gas-price - The gas price - - --block-base-fee-per-gas - The base fee in a block - - [aliases: base-fee] - - --tx-origin
- The transaction origin - - --block-coinbase
- The coinbase of the block - - --block-timestamp - The timestamp of the block - - --block-number - The block number - - --block-difficulty - The block difficulty - - --block-prevrandao - The block prevrandao value. NOTE: Before merge this field was mix_hash - - --block-gas-limit - The block gas limit - - [aliases: gas-limit] - - --memory-limit - The memory limit per EVM execution in bytes. If this limit is - exceeded, a `MemoryLimitOOG` result is thrown. - - The default is 128MiB. - - --disable-block-gas-limit - Whether to disable the block gas limit checks - - [aliases: no-gas-limit] - - --isolate - Whether to enable isolation of calls. In isolation mode all top-level - calls are executed as a separate transaction in a separate EVM - context, enabling more precise gas accounting and transaction state - changes - - --odyssey - Whether to enable Odyssey features - -Display options: - --color - The color of the log messages - - Possible values: - - auto: Intelligently guess whether to use color output (default) - - always: Force color output - - never: Force disable color output - - --json - Format log messages as JSON - - -q, --quiet - Do not print log messages - - -v, --verbosity... - Verbosity level of the log messages. - - Pass multiple times to increase the verbosity (e.g. -v, -vv, -vvv). - - Depending on the context the verbosity levels have different meanings. - - For example, the verbosity levels of the EVM are: - - 2 (-vv): Print logs for all tests. - - 3 (-vvv): Print execution traces for failing tests. - - 4 (-vvvv): Print execution traces for all tests, and setup traces - for failing tests. - - 5 (-vvvvv): Print execution and setup traces for all tests, - including storage changes. -``` \ No newline at end of file diff --git a/src/reference/forge/forge-debug.md b/src/reference/forge/forge-debug.md deleted file mode 100644 index c8e9899b2..000000000 --- a/src/reference/forge/forge-debug.md +++ /dev/null @@ -1,100 +0,0 @@ -## forge debug - -### NAME - -forge-debug - Debug a single smart contract as a script. - -### SYNOPSIS - -``forge debug`` [*options*] *path* [*args...*] - -### DESCRIPTION - -Debugs a single smart contract located in the source file (*path*) as a script. - -If multiple contracts are in the specified source file, you must pass `--target-contract` to specify -what contract you want to run. - -#### Calls - -After the script is deployed to the internal EVM a call is made to a function with the signature `setUp()`, if present. - -By default, the script is assumed to be contained in a function with the signature `run()`. If you wish to -run a different function, pass `--sig `. - -The signature can be a fragment (`()`), or raw calldata. - -If you pass a fragment, and the function has parameters, you can add the call parameters to the end of the command (*args*). - -#### Forking - -It is possible to run the script in a forked environment by passing `--fork-url `. - -When the script is running in a forked environment, you can access all the state of the forked chain as you would -if you had deployed the script. [Cheatcodes][cheatcodes] are still available. - -You can also specify a block number to fork from by passing `--fork-block-number `. When forking from a -specific block, the chain data is cached to `~/.foundry/cache`. If you do not want to cache the chain data, -pass `--no-storage-caching`. - -#### Debugging - -It is possible to run the script in an interactive debugger. To start the debugger, pass `--debug`. - -More information on the debugger can be found in the [debugger chapter][debugger]. - -### OPTIONS - -#### Debug Options - -`--target-contract` *contract_name* -    The name of the contract you want to run - -`-s` *signature* -`--sig` *signature* -    The signature of the function you want to call in the contract, or raw calldata. Default: `run()` - -`--debug` -    Open the script in the [debugger][debugger]. - -{{#include evm-options.md}} - -{{#include executor-options.md}} - -{{#include core-build-options.md}} - -{{#include common-options.md}} - -### EXAMPLES - -1. Execute the `run()` function in a contract: - ```sh - forge debug src/Contract.sol - ``` - -2. Open a script in the debugger: - ```sh - forge debug src/Contract.sol --debug - ``` - -3. Execute the `foo()` function in a contract: - ```sh - forge debug src/Contract.sol --sig "foo()" - ``` - -4. Execute a contract with a function that takes parameters: - ```sh - forge debug src/Contract.sol --sig "foo(string,uint256)" "hello" 100 - ``` - -5. Execute a contract with raw calldata: - ```sh - forge debug src/Contract.sol --sig "0x..." - ``` - -### SEE ALSO - -[forge](./forge.md), [forge test](./forge-test.md) - -[debugger]: ../../forge/debugger.md -[cheatcodes]: ../../cheatcodes/ diff --git a/src/reference/forge/forge.md b/src/reference/forge/forge.md index 4f187ccbd..1f17b7125 100644 --- a/src/reference/forge/forge.md +++ b/src/reference/forge/forge.md @@ -91,9 +91,6 @@ This program is a set of tools to build, test, fuzz, debug and deploy Solidity s #### Utility Commands -[forge debug](./forge-debug.md) -    Debug a single smart contract as a script. - [forge bind](./forge-bind.md)     Generate Rust bindings for smart contracts. diff --git a/src/reference/forge/test-options.md b/src/reference/forge/test-options.md index af1fca6cc..c629f1722 100644 --- a/src/reference/forge/test-options.md +++ b/src/reference/forge/test-options.md @@ -34,8 +34,6 @@     If the matching test is a fuzz test, then it will open the debugger on the first failure case. If the fuzz test does not fail, it will open the debugger on the last fuzz case. -    For more fine-grained control of which fuzz case is run, see [`forge debug`](./forge-debug.md). - `--gas-report`     Print a gas report. diff --git a/src/reference/forge/utility-commands.md b/src/reference/forge/utility-commands.md index bd3e78e18..341cbed96 100644 --- a/src/reference/forge/utility-commands.md +++ b/src/reference/forge/utility-commands.md @@ -1,10 +1,9 @@ ## Utility Commands -- [forge debug](./forge-debug.md) - [forge bind](./forge-bind.md) -- [forge cache](./forge-cache.md) -- [forge cache clean](./forge-cache-clean.md) -- [forge cache ls](./forge-cache-ls.md) -- [forge script](./forge-script.md) +- [forge cache](./forge-cache.md) +- [forge cache clean](./forge-cache-clean.md) +- [forge cache ls](./forge-cache-ls.md) +- [forge script](./forge-script.md) - [forge upload-selectors](./forge-upload-selectors.md) - [forge doc](./forge-doc.md)