From 17ff8851a714332400bc8a5fcd6d6657259fba6b Mon Sep 17 00:00:00 2001 From: Rm1210 <2641747+Rm1210@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:17:45 +0800 Subject: [PATCH 01/15] Update cast-logs.md (#1308) Fix: Correct errors in cast logs example --- src/reference/cast/cast-logs.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reference/cast/cast-logs.md b/src/reference/cast/cast-logs.md index b12a0073f..8dd71210d 100644 --- a/src/reference/cast/cast-logs.md +++ b/src/reference/cast/cast-logs.md @@ -44,11 +44,11 @@ If using a signature, remaining arguments must be in their ordinary form. If usi 1. Get logs using a signature: ```sh - cast logs --from-block 15537393 --to-block latest 'Transfer (address indexed from, address indexed to, uint256 value)' 0x2e8ABfE042886E4938201101A63730D04F160A82 + cast logs --from-block 15537393 --to-block latest 'Transfer (address indexed from, address indexed to, uint256 value)' --address 0x2e8ABfE042886E4938201101A63730D04F160A82 ``` 2. Get logs using a topic: ```sh - cast logs --from-block 15537393 --to-block latest 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef 0x0000000000000000000000002e8abfe042886e4938201101a63730d04f160a82 + cast logs --from-block 15537393 --to-block latest 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef --address 0x0000000000000000000000002e8abfe042886e4938201101a63730d04f160a82 ``` ### SEE ALSO From 75e1e2feda08d0cd29b4680cf5c24395c39e1b88 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 22 Sep 2024 09:11:03 +0200 Subject: [PATCH 02/15] update command output (#1310) --- src/output/cast/cast-call | 2 +- src/output/cheatcodes/forge-test-cheatcodes | 4 +-- .../forge-test-cheatcodes-expectrevert | 4 +-- .../cheatcodes/forge-test-cheatcodes-tracing | 4 +-- src/output/cheatcodes/forge-test-simple | 6 ++--- src/output/deps/forge-install | 2 +- src/output/foundry-template/forge-build | 2 +- src/output/foundry-template/forge-test | 4 +-- src/output/fuzz_testing/forge-test-fail-fuzz | 6 ++--- src/output/fuzz_testing/forge-test-no-fuzz | 6 ++--- .../fuzz_testing/forge-test-success-fuzz | 8 +++--- src/output/hello_foundry/forge-build | 2 +- src/output/hello_foundry/forge-init | 4 +-- src/output/hello_foundry/forge-test | 6 ++--- src/output/nft_tutorial/forge-test | 26 +++++++++---------- .../forge-test-match-contract-and-test | 6 ++--- src/output/test_filters/forge-test-match-path | 6 ++--- 17 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/output/cast/cast-call b/src/output/cast/cast-call index ba9343ca8..9d62261f4 100644 --- a/src/output/cast/cast-call +++ b/src/output/cast/cast-call @@ -3,6 +3,6 @@ $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf // ANCHOR_END: command // ANCHOR: output -3189192687344152474307155726 [3.189e27] +3068594554705130827666987021 [3.068e27] // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes b/src/output/cheatcodes/forge-test-cheatcodes index 75a58273e..5ea4667e8 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes +++ b/src/output/cheatcodes/forge-test-cheatcodes @@ -8,8 +8,8 @@ No files changed, compilation skipped Ran 2 tests for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] testFail_IncrementAsNotOwner() (gas: 8314) [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 562.63µs (204.18µs CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 556.16µs (261.83µs CPU time) -Ran 1 test suite in 5.33ms (562.63µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.05ms (556.16µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert index 9f9ce3321..0abbc8202 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert +++ b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert @@ -7,8 +7,8 @@ No files changed, compilation skipped Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 440.77µs (73.08µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 464.86µs (72.10µs CPU time) -Ran 1 test suite in 5.48ms (440.77µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.88ms (464.86µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-tracing b/src/output/cheatcodes/forge-test-cheatcodes-tracing index 1f727d2a0..41e48a769 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-tracing +++ b/src/output/cheatcodes/forge-test-cheatcodes-tracing @@ -15,8 +15,8 @@ Traces: │ └─ ← [Revert] Unauthorized() └─ ← [Revert] Unauthorized() -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 513.84µs (79.04µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 430.81µs (69.93µs CPU time) -Ran 1 test suite in 5.62ms (513.84µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 7.11ms (430.81µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-simple b/src/output/cheatcodes/forge-test-simple index 80def449e..f767d0d99 100644 --- a/src/output/cheatcodes/forge-test-simple +++ b/src/output/cheatcodes/forge-test-simple @@ -4,13 +4,13 @@ $ forge test --match-test test_IncrementAsOwner // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.14s +Solc 0.8.10 finished in 1.15s Compiler run successful! Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 460.07µs (65.70µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 446.95µs (63.24µs CPU time) -Ran 1 test suite in 5.16ms (460.07µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.94ms (446.95µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/deps/forge-install b/src/output/deps/forge-install index 775eaf949..9716c5963 100644 --- a/src/output/deps/forge-install +++ b/src/output/deps/forge-install @@ -3,7 +3,7 @@ $ forge install transmissions11/solmate // ANCHOR_END: command // ANCHOR: output -Installing solmate in /tmp/tmp.EeHRsNb8sO/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) +Installing solmate in /tmp/tmp.dH3QKReB7L/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) Installed solmate // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-build b/src/output/foundry-template/forge-build index 546d405dd..4467c60a9 100644 --- a/src/output/foundry-template/forge-build +++ b/src/output/foundry-template/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 28 files with Solc 0.8.25 -Solc 0.8.25 finished in 1.35s +Solc 0.8.25 finished in 1.36s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-test b/src/output/foundry-template/forge-test index dd7b358f2..dc1a2a696 100644 --- a/src/output/foundry-template/forge-test +++ b/src/output/foundry-template/forge-test @@ -9,8 +9,8 @@ Ran 3 tests for test/Foo.t.sol:FooTest [PASS] testFork_Example() (gas: 3779) [PASS] testFuzz_Example(uint256) (runs: 1000, μ: 9111, ~: 9111) [PASS] test_Example() (gas: 11861) -Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 23.36ms (22.98ms CPU time) +Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 19.30ms (19.24ms CPU time) -Ran 1 test suite in 24.49ms (23.36ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) +Ran 1 test suite in 20.23ms (19.30ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-fail-fuzz b/src/output/fuzz_testing/forge-test-fail-fuzz index 77f6c56ef..0e7392145 100644 --- a/src/output/fuzz_testing/forge-test-fail-fuzz +++ b/src/output/fuzz_testing/forge-test-fail-fuzz @@ -8,9 +8,9 @@ Solc 0.8.10 finished in 1.08s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[FAIL: EvmError: Revert; counterexample: calldata=0x29facca700000000000000000000000000000000f45663667f8ecfc2ec509a7f64736f6d args=[324780184580654050974171636162169630573 [3.247e38]]] testFuzz_Withdraw(uint256) (runs: 9, μ: 19531, ~: 19531) -Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 1.22ms (768.07µs CPU time) +[FAIL: EvmError: Revert; counterexample: calldata=0x29facca70000000000000000000000000000000000000d96d383eccf6b3dbd02772997e8 args=[275621010049270732997116746635240 [2.756e32]]] testFuzz_Withdraw(uint256) (runs: 0, μ: 0, ~: 0) +Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 745.89µs (374.22µs CPU time) -Ran 1 test suite in 5.61ms (1.22ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.33ms (745.89µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-no-fuzz b/src/output/fuzz_testing/forge-test-no-fuzz index 12c696392..1af9ea207 100644 --- a/src/output/fuzz_testing/forge-test-no-fuzz +++ b/src/output/fuzz_testing/forge-test-no-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.14s +Solc 0.8.10 finished in 1.13s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest [PASS] test_Withdraw() (gas: 19463) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 494.84µs (66.56µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 478.24µs (74.53µs CPU time) -Ran 1 test suite in 5.26ms (494.84µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.83ms (478.24µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-success-fuzz b/src/output/fuzz_testing/forge-test-success-fuzz index dca71dcbe..75a451e31 100644 --- a/src/output/fuzz_testing/forge-test-success-fuzz +++ b/src/output/fuzz_testing/forge-test-success-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.10s +Solc 0.8.10 finished in 1.12s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19370, ~: 19631) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.29ms (4.82ms CPU time) +[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19422, ~: 19631) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.92ms (4.53ms CPU time) -Ran 1 test suite in 6.28ms (5.29ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.95ms (4.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-build b/src/output/hello_foundry/forge-build index d31f2ca2f..a1849c7e5 100644 --- a/src/output/hello_foundry/forge-build +++ b/src/output/hello_foundry/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 27 files with Solc 0.8.19 -Solc 0.8.19 finished in 1.09s +Solc 0.8.19 finished in 1.12s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-init b/src/output/hello_foundry/forge-init index 7b3c54fc0..9d20ada2e 100644 --- a/src/output/hello_foundry/forge-init +++ b/src/output/hello_foundry/forge-init @@ -3,8 +3,8 @@ $ forge init hello_foundry // ANCHOR_END: command // ANCHOR: output -Initializing /tmp/tmp.l8BNexEdUb/hello_foundry... -Installing forge-std in /tmp/tmp.l8BNexEdUb/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) +Initializing /tmp/tmp.MBMAU8aK71/hello_foundry... +Installing forge-std in /tmp/tmp.MBMAU8aK71/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) Installed forge-std v1.9.2 Initialized forge project // ANCHOR_END: output diff --git a/src/output/hello_foundry/forge-test b/src/output/hello_foundry/forge-test index 9cdc4cb6c..4dfad0c30 100644 --- a/src/output/hello_foundry/forge-test +++ b/src/output/hello_foundry/forge-test @@ -6,10 +6,10 @@ $ forge test No files changed, compilation skipped Ran 2 tests for test/Counter.t.sol:CounterTest -[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 31132, ~: 31288) +[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 31210, ~: 31288) [PASS] test_Increment() (gas: 31303) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.32ms (7.95ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 7.90ms (7.55ms CPU time) -Ran 1 test suite in 9.50ms (8.32ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 8.87ms (7.90ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/nft_tutorial/forge-test b/src/output/nft_tutorial/forge-test index 9cddfa2c3..852866f39 100644 --- a/src/output/nft_tutorial/forge-test +++ b/src/output/nft_tutorial/forge-test @@ -5,17 +5,6 @@ $ forge test // ANCHOR: output No files changed, compilation skipped -Ran 8 tests for test/SolmateNft.sol:SolmateNftTests -[PASS] testBalanceIncremented() (gas: 217400) -[PASS] testFailMaxSupplyReached() (gas: 134524) -[PASS] testFailMintToZeroAddress() (gas: 34521) -[PASS] testFailNoMintPricePaid() (gas: 5568) -[PASS] testFailUnSafeContractReceiver() (gas: 3524) -[PASS] testMintPricePaid() (gas: 81321) -[PASS] testNewMintOwnerRegistered() (gas: 190741) -[PASS] testSafeContractReceiver() (gas: 272636) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.60ms (1.38ms CPU time) - Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests [PASS] testBalanceIncremented() (gas: 217829) [PASS] testFailMaxSupplyReached() (gas: 134524) @@ -25,8 +14,19 @@ Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests [PASS] testMintPricePaid() (gas: 81554) [PASS] testNewMintOwnerRegistered() (gas: 190956) [PASS] testSafeContractReceiver() (gas: 273132) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.60ms (1.19ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.51ms (1.16ms CPU time) + +Ran 8 tests for test/SolmateNft.sol:SolmateNftTests +[PASS] testBalanceIncremented() (gas: 217400) +[PASS] testFailMaxSupplyReached() (gas: 134524) +[PASS] testFailMintToZeroAddress() (gas: 34521) +[PASS] testFailNoMintPricePaid() (gas: 5568) +[PASS] testFailUnSafeContractReceiver() (gas: 3524) +[PASS] testMintPricePaid() (gas: 81321) +[PASS] testNewMintOwnerRegistered() (gas: 190741) +[PASS] testSafeContractReceiver() (gas: 272636) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.51ms (1.31ms CPU time) -Ran 2 test suites in 5.36ms (3.20ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) +Ran 2 test suites in 5.17ms (3.03ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-contract-and-test b/src/output/test_filters/forge-test-match-contract-and-test index bc3487a77..b197fb844 100644 --- a/src/output/test_filters/forge-test-match-contract-and-test +++ b/src/output/test_filters/forge-test-match-contract-and-test @@ -4,14 +4,14 @@ $ forge test --match-contract ComplicatedContractTest --match-test test_Deposit // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.10s +Solc 0.8.10 finished in 1.13s Compiler run successful! Ran 2 tests for test/ComplicatedContract.t.sol:ComplicatedContractTest [PASS] test_DepositERC20() (gas: 102193) [PASS] test_DepositETH() (gas: 61414) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.34ms (1.40ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.07ms (1.24ms CPU time) -Ran 1 test suite in 5.44ms (1.34ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.34ms (1.07ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-path b/src/output/test_filters/forge-test-match-path index 34176b08e..21fa750d9 100644 --- a/src/output/test_filters/forge-test-match-path +++ b/src/output/test_filters/forge-test-match-path @@ -4,13 +4,13 @@ $ forge test --match-path test/ContractB.t.sol // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.08s +Solc 0.8.10 finished in 1.06s Compiler run successful! Ran 1 test for test/ContractB.t.sol:ContractBTest [PASS] testExample() (gas: 257) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 361.35µs (47.47µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 380.23µs (68.07µs CPU time) -Ran 1 test suite in 5.06ms (361.35µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.91ms (380.23µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all From 1d3bf3d75de9af1573d7bab798e6b06ce29ac525 Mon Sep 17 00:00:00 2001 From: Josh <39901876+jjoshm@users.noreply.github.com> Date: Sun, 22 Sep 2024 11:36:36 +0200 Subject: [PATCH 03/15] cast-etherscan-source add missing flatten option (#1309) --- src/reference/cast/cast-etherscan-source.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/reference/cast/cast-etherscan-source.md b/src/reference/cast/cast-etherscan-source.md index d59649172..39c5547f2 100644 --- a/src/reference/cast/cast-etherscan-source.md +++ b/src/reference/cast/cast-etherscan-source.md @@ -22,6 +22,10 @@ The destination (*to*) can be an ENS name or an address.     The output directory to expand the source tree into.     If not provided, the source will be outputted to stdout. +`-f` +`--flatten` +    Whether to flatten the source code. + {{#include ../common/etherscan-options.md}} {{#include common-options.md}} From ce804d1d2472cd151d03a58c7c646764f1940260 Mon Sep 17 00:00:00 2001 From: Matthias Seitz Date: Sun, 22 Sep 2024 18:45:10 +0200 Subject: [PATCH 04/15] Update installation.md (#1313) --- src/getting-started/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/getting-started/installation.md b/src/getting-started/installation.md index cbe71d3ca..749925414 100644 --- a/src/getting-started/installation.md +++ b/src/getting-started/installation.md @@ -49,7 +49,7 @@ foundryup --path path/to/foundry Alternatively, you can install via Cargo with the following command: ```sh -cargo install --git https://github.com/foundry-rs/foundry --profile release --locked forge cast chisel anvil +cargo install --git https://github.com/foundry-rs/foundry --profile release --locked forge foundry-cast chisel anvil ``` You can also manually build from a local copy of the [Foundry repository](https://github.com/foundry-rs/foundry): From 3d22abac4cc7429286da743693df6d33e4c913e8 Mon Sep 17 00:00:00 2001 From: smorodina Date: Mon, 23 Sep 2024 03:47:39 +0900 Subject: [PATCH 05/15] Update installation.md (#1312) From 06afa8cc8b9342a238ce053626b6344c88660d44 Mon Sep 17 00:00:00 2001 From: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:42:16 +0200 Subject: [PATCH 06/15] Document `--sender` as part of the tutorial for `forge script` (#1314) * document --sender as part of the tutorial for forge script * clean up --- src/tutorials/solidity-scripting.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/tutorials/solidity-scripting.md b/src/tutorials/solidity-scripting.md index 3dd2fd176..659ea6b74 100644 --- a/src/tutorials/solidity-scripting.md +++ b/src/tutorials/solidity-scripting.md @@ -226,6 +226,12 @@ NFT nft = new NFT("NFT_tutorial", "TUT", "baseUri"); Here we have just created our NFT contract. Because we called `vm.startBroadcast()` before this line, the contract creation will be recorded by Forge, and as mentioned previously, we can broadcast the transaction to deploy the contract on-chain. The broadcast transaction logs will be stored in the `broadcast` directory by default. You can change the logs location by setting [`broadcast`](../reference/config/project.md#broadcast) in your `foundry.toml` file. +The broadcasting sender is determined by checking the following in order: + +1. If `--sender` argument was provided, that address is used. +2. If exactly one signer (e.g. private key, hardware wallet, keystore) is set, that signer is used. +3. Otherwise, the default Foundry sender (`0x1804c8AB1F12E6bbf3894d4083f33e07309d1f38`) is attempted to be used. + Now that you’re up to speed about what the script smart contract does, let’s run it. You should have added the variables we mentioned earlier to the `.env` for this next part to work. From 8423c1b04c23e05e0e7b704ea3c0df9f36afc4a9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 29 Sep 2024 02:58:49 +0200 Subject: [PATCH 07/15] update command output (#1319) Co-authored-by: mattsse --- src/output/cast/cast-call | 2 +- src/output/cheatcodes/forge-test-cheatcodes | 4 +- .../forge-test-cheatcodes-expectrevert | 4 +- .../cheatcodes/forge-test-cheatcodes-tracing | 4 +- src/output/cheatcodes/forge-test-simple | 6 +- src/output/deps/forge-install | 2 +- src/output/foundry-template/forge-build | 2 +- src/output/foundry-template/forge-test | 4 +- src/output/fuzz_testing/forge-test-fail-fuzz | 8 +-- src/output/fuzz_testing/forge-test-no-fuzz | 6 +- .../fuzz_testing/forge-test-success-fuzz | 8 +-- src/output/hello_foundry/forge-build | 2 +- src/output/hello_foundry/forge-init | 6 +- src/output/hello_foundry/forge-test | 6 +- src/output/nft_tutorial/forge-test | 6 +- .../forge-test-match-contract-and-test | 6 +- src/output/test_filters/forge-test-match-path | 6 +- src/reference/cli/forge.md | 2 +- src/reference/cli/forge/coverage.md | 43 ++++++--------- src/reference/cli/forge/create.md | 2 +- src/reference/cli/forge/script.md | 2 +- src/reference/cli/forge/snapshot.md | 55 ++++++++----------- src/reference/cli/forge/test.md | 43 ++++++--------- src/reference/cli/forge/verify-check.md | 2 +- src/reference/cli/forge/verify-contract.md | 2 +- 25 files changed, 106 insertions(+), 127 deletions(-) diff --git a/src/output/cast/cast-call b/src/output/cast/cast-call index 9d62261f4..d70b4efb8 100644 --- a/src/output/cast/cast-call +++ b/src/output/cast/cast-call @@ -3,6 +3,6 @@ $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf // ANCHOR_END: command // ANCHOR: output -3068594554705130827666987021 [3.068e27] +3034745150676479763720898483 [3.034e27] // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes b/src/output/cheatcodes/forge-test-cheatcodes index 5ea4667e8..36a403612 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes +++ b/src/output/cheatcodes/forge-test-cheatcodes @@ -8,8 +8,8 @@ No files changed, compilation skipped Ran 2 tests for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] testFail_IncrementAsNotOwner() (gas: 8314) [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 556.16µs (261.83µs CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 449.40µs (147.65µs CPU time) -Ran 1 test suite in 5.05ms (556.16µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 4.93ms (449.40µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert index 0abbc8202..ead65844d 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert +++ b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert @@ -7,8 +7,8 @@ No files changed, compilation skipped Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 464.86µs (72.10µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 419.68µs (76.67µs CPU time) -Ran 1 test suite in 4.88ms (464.86µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.91ms (419.68µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-tracing b/src/output/cheatcodes/forge-test-cheatcodes-tracing index 41e48a769..a16b8bc7e 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-tracing +++ b/src/output/cheatcodes/forge-test-cheatcodes-tracing @@ -15,8 +15,8 @@ Traces: │ └─ ← [Revert] Unauthorized() └─ ← [Revert] Unauthorized() -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 430.81µs (69.93µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 485.11µs (72.49µs CPU time) -Ran 1 test suite in 7.11ms (430.81µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.95ms (485.11µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-simple b/src/output/cheatcodes/forge-test-simple index f767d0d99..05d2d7259 100644 --- a/src/output/cheatcodes/forge-test-simple +++ b/src/output/cheatcodes/forge-test-simple @@ -4,13 +4,13 @@ $ forge test --match-test test_IncrementAsOwner // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.15s +Solc 0.8.10 finished in 1.14s Compiler run successful! Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 446.95µs (63.24µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 419.24µs (51.86µs CPU time) -Ran 1 test suite in 4.94ms (446.95µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.84ms (419.24µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/deps/forge-install b/src/output/deps/forge-install index 9716c5963..875b02c2e 100644 --- a/src/output/deps/forge-install +++ b/src/output/deps/forge-install @@ -3,7 +3,7 @@ $ forge install transmissions11/solmate // ANCHOR_END: command // ANCHOR: output -Installing solmate in /tmp/tmp.dH3QKReB7L/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) +Installing solmate in /tmp/tmp.688D1rxuMB/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) Installed solmate // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-build b/src/output/foundry-template/forge-build index 4467c60a9..2c04f92c7 100644 --- a/src/output/foundry-template/forge-build +++ b/src/output/foundry-template/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 28 files with Solc 0.8.25 -Solc 0.8.25 finished in 1.36s +Solc 0.8.25 finished in 1.34s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-test b/src/output/foundry-template/forge-test index dc1a2a696..5650b8268 100644 --- a/src/output/foundry-template/forge-test +++ b/src/output/foundry-template/forge-test @@ -9,8 +9,8 @@ Ran 3 tests for test/Foo.t.sol:FooTest [PASS] testFork_Example() (gas: 3779) [PASS] testFuzz_Example(uint256) (runs: 1000, μ: 9111, ~: 9111) [PASS] test_Example() (gas: 11861) -Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 19.30ms (19.24ms CPU time) +Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 21.62ms (21.42ms CPU time) -Ran 1 test suite in 20.23ms (19.30ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) +Ran 1 test suite in 22.57ms (21.62ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-fail-fuzz b/src/output/fuzz_testing/forge-test-fail-fuzz index 0e7392145..c5450fb4e 100644 --- a/src/output/fuzz_testing/forge-test-fail-fuzz +++ b/src/output/fuzz_testing/forge-test-fail-fuzz @@ -4,13 +4,13 @@ $ forge test --allow-failure // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.08s +Solc 0.8.10 finished in 1.11s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[FAIL: EvmError: Revert; counterexample: calldata=0x29facca70000000000000000000000000000000000000d96d383eccf6b3dbd02772997e8 args=[275621010049270732997116746635240 [2.756e32]]] testFuzz_Withdraw(uint256) (runs: 0, μ: 0, ~: 0) -Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 745.89µs (374.22µs CPU time) +[FAIL: EvmError: Revert; counterexample: calldata=0x29facca70000000000000000000000000000002f8f4586edd6d7cea729964c5bb9a01453 args=[16183711853851041747958787769756475724883 [1.618e40]]] testFuzz_Withdraw(uint256) (runs: 0, μ: 0, ~: 0) +Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 762.95µs (408.45µs CPU time) -Ran 1 test suite in 5.33ms (745.89µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.39ms (762.95µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-no-fuzz b/src/output/fuzz_testing/forge-test-no-fuzz index 1af9ea207..5d70c25cc 100644 --- a/src/output/fuzz_testing/forge-test-no-fuzz +++ b/src/output/fuzz_testing/forge-test-no-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.13s +Solc 0.8.10 finished in 1.15s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest [PASS] test_Withdraw() (gas: 19463) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 478.24µs (74.53µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 393.78µs (38.23µs CPU time) -Ran 1 test suite in 4.83ms (478.24µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.07ms (393.78µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-success-fuzz b/src/output/fuzz_testing/forge-test-success-fuzz index 75a451e31..b52082f23 100644 --- a/src/output/fuzz_testing/forge-test-success-fuzz +++ b/src/output/fuzz_testing/forge-test-success-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.12s +Solc 0.8.10 finished in 1.07s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19422, ~: 19631) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.92ms (4.53ms CPU time) +[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19266, ~: 19631) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.29ms (4.92ms CPU time) -Ran 1 test suite in 5.95ms (4.92ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 6.17ms (5.29ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-build b/src/output/hello_foundry/forge-build index a1849c7e5..d31f2ca2f 100644 --- a/src/output/hello_foundry/forge-build +++ b/src/output/hello_foundry/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 27 files with Solc 0.8.19 -Solc 0.8.19 finished in 1.12s +Solc 0.8.19 finished in 1.09s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-init b/src/output/hello_foundry/forge-init index 9d20ada2e..553021d1b 100644 --- a/src/output/hello_foundry/forge-init +++ b/src/output/hello_foundry/forge-init @@ -3,9 +3,9 @@ $ forge init hello_foundry // ANCHOR_END: command // ANCHOR: output -Initializing /tmp/tmp.MBMAU8aK71/hello_foundry... -Installing forge-std in /tmp/tmp.MBMAU8aK71/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) - Installed forge-std v1.9.2 +Initializing /tmp/tmp.NnQcg2Vq8E/hello_foundry... +Installing forge-std in /tmp/tmp.NnQcg2Vq8E/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) + Installed forge-std v1.9.3 Initialized forge project // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-test b/src/output/hello_foundry/forge-test index 4dfad0c30..6736701a1 100644 --- a/src/output/hello_foundry/forge-test +++ b/src/output/hello_foundry/forge-test @@ -6,10 +6,10 @@ $ forge test No files changed, compilation skipped Ran 2 tests for test/Counter.t.sol:CounterTest -[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 31210, ~: 31288) +[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 30899, ~: 31288) [PASS] test_Increment() (gas: 31303) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 7.90ms (7.55ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.15ms (7.83ms CPU time) -Ran 1 test suite in 8.87ms (7.90ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 9.00ms (8.15ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/nft_tutorial/forge-test b/src/output/nft_tutorial/forge-test index 852866f39..23ee5c643 100644 --- a/src/output/nft_tutorial/forge-test +++ b/src/output/nft_tutorial/forge-test @@ -14,7 +14,7 @@ Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests [PASS] testMintPricePaid() (gas: 81554) [PASS] testNewMintOwnerRegistered() (gas: 190956) [PASS] testSafeContractReceiver() (gas: 273132) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.51ms (1.16ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.58ms (1.29ms CPU time) Ran 8 tests for test/SolmateNft.sol:SolmateNftTests [PASS] testBalanceIncremented() (gas: 217400) @@ -25,8 +25,8 @@ Ran 8 tests for test/SolmateNft.sol:SolmateNftTests [PASS] testMintPricePaid() (gas: 81321) [PASS] testNewMintOwnerRegistered() (gas: 190741) [PASS] testSafeContractReceiver() (gas: 272636) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.51ms (1.31ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.58ms (1.43ms CPU time) -Ran 2 test suites in 5.17ms (3.03ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) +Ran 2 test suites in 5.10ms (3.16ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-contract-and-test b/src/output/test_filters/forge-test-match-contract-and-test index b197fb844..f7e84d117 100644 --- a/src/output/test_filters/forge-test-match-contract-and-test +++ b/src/output/test_filters/forge-test-match-contract-and-test @@ -4,14 +4,14 @@ $ forge test --match-contract ComplicatedContractTest --match-test test_Deposit // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.13s +Solc 0.8.10 finished in 1.11s Compiler run successful! Ran 2 tests for test/ComplicatedContract.t.sol:ComplicatedContractTest [PASS] test_DepositERC20() (gas: 102193) [PASS] test_DepositETH() (gas: 61414) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.07ms (1.24ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.14ms (1.49ms CPU time) -Ran 1 test suite in 5.34ms (1.07ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.32ms (1.14ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-path b/src/output/test_filters/forge-test-match-path index 21fa750d9..4e261a607 100644 --- a/src/output/test_filters/forge-test-match-path +++ b/src/output/test_filters/forge-test-match-path @@ -4,13 +4,13 @@ $ forge test --match-path test/ContractB.t.sol // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.06s +Solc 0.8.10 finished in 1.05s Compiler run successful! Ran 1 test for test/ContractB.t.sol:ContractBTest [PASS] testExample() (gas: 257) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 380.23µs (68.07µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 316.30µs (54.90µs CPU time) -Ran 1 test suite in 4.91ms (380.23µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 4.85ms (316.30µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/reference/cli/forge.md b/src/reference/cli/forge.md index 6dfd58f06..6a6cb8534 100644 --- a/src/reference/cli/forge.md +++ b/src/reference/cli/forge.md @@ -44,7 +44,7 @@ Commands: script Run a smart contract as a script, building transactions that can be sent onchain selectors Function selector utilities [aliases: se] - snapshot Create a snapshot of each test's gas usage [aliases: s] + snapshot Create a gas snapshot of each test's gas usage [aliases: s] soldeer Soldeer dependency manager test Run the project's tests [aliases: t] tree Display a tree visualization of the project's dependency diff --git a/src/reference/cli/forge/coverage.md b/src/reference/cli/forge/coverage.md index c97bdbdc0..7da203273 100644 --- a/src/reference/cli/forge/coverage.md +++ b/src/reference/cli/forge/coverage.md @@ -37,15 +37,8 @@ Options: Print help (see a summary with '-h') Test options: - --debug - Run a test in the debugger. - - The argument passed to this flag is the name of the test function you - want to run, and it works the same as --match-test. - - If more than one test matches your specified criteria, you must add - additional filters until only one test is found (see --match-contract - and --match-path). + --debug [] + Run a single test in the debugger. The matching test will be opened in the debugger regardless of the outcome of the test. @@ -53,29 +46,29 @@ Test options: 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 - run. --flamegraph - Generate a flamegraph for a single test. Implies `--decode-internal` + Generate a flamegraph for a single test. Implies `--decode-internal`. + + A flame graph is used to visualize which functions or operations + within the smart contract are consuming the most gas overall in a + sorted manner. --flamechart - Generate a flamechart for a single test. Implies `--decode-internal` - - --decode-internal [] - Whether to identify internal functions in traces. + Generate a flamechart for a single test. Implies `--decode-internal`. - If no argument is passed to this flag, it will trace internal - functions scope and decode stack parameters, but parameters stored in - memory (such as bytes or arrays) will not be decoded. + A flame chart shows the gas usage over time, illustrating when each + function is called (execution order) and how much gas it consumes at + each point in the timeline. + + --decode-internal [] + Identify internal functions in traces. - To decode memory parameters, you should pass an argument with a test - function name, similarly to --debug and --match-test. + This will trace internal functions and decode stack parameters. - If more than one test matches your specified criteria, you must add - additional filters until only one test is found (see --match-contract - and --match-path). + Parameters stored in memory (such as bytes or arrays) are currently + decoded only when a single function is matched, similarly to + `--debug`, for performance reasons. --gas-report Print a gas report diff --git a/src/reference/cli/forge/create.md b/src/reference/cli/forge/create.md index e4d3d340d..3291df2d8 100644 --- a/src/reference/cli/forge/create.md +++ b/src/reference/cli/forge/create.md @@ -305,7 +305,7 @@ Wallet options - raw: [default: 5] --delay - Optional delay to apply inbetween verification attempts, in seconds + Optional delay to apply in between verification attempts, in seconds [default: 5] diff --git a/src/reference/cli/forge/script.md b/src/reference/cli/forge/script.md index 1afbb819a..134c624dc 100644 --- a/src/reference/cli/forge/script.md +++ b/src/reference/cli/forge/script.md @@ -471,7 +471,7 @@ Executor environment config: [default: 5] --delay - Optional delay to apply inbetween verification attempts, in seconds + Optional delay to apply in between verification attempts, in seconds [default: 5] diff --git a/src/reference/cli/forge/snapshot.md b/src/reference/cli/forge/snapshot.md index 4fa93ff0a..6bbb1a040 100644 --- a/src/reference/cli/forge/snapshot.md +++ b/src/reference/cli/forge/snapshot.md @@ -1,6 +1,6 @@ # forge snapshot -Create a snapshot of each test's gas usage +Create a gas snapshot of each test's gas usage ```bash $ forge snapshot --help @@ -11,20 +11,20 @@ Usage: forge snapshot [OPTIONS] [PATH] Options: --diff [] - Output a diff against a pre-existing snapshot. + Output a diff against a pre-existing gas snapshot. By default, the comparison is done with .gas-snapshot. --check [] - Compare against a pre-existing snapshot, exiting with code 1 if they - do not match. + Compare against a pre-existing gas snapshot, exiting with code 1 if + they do not match. - Outputs a diff if the snapshots do not match. + Outputs a diff if the gas snapshots do not match. By default, the comparison is done with .gas-snapshot. --snap - Output file for the snapshot + Output file for the gas snapshot [default: .gas-snapshot] @@ -35,15 +35,8 @@ Options: Print help (see a summary with '-h') Test options: - --debug - Run a test in the debugger. - - The argument passed to this flag is the name of the test function you - want to run, and it works the same as --match-test. - - If more than one test matches your specified criteria, you must add - additional filters until only one test is found (see --match-contract - and --match-path). + --debug [] + Run a single test in the debugger. The matching test will be opened in the debugger regardless of the outcome of the test. @@ -51,29 +44,29 @@ Test options: 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 - run. --flamegraph - Generate a flamegraph for a single test. Implies `--decode-internal` + Generate a flamegraph for a single test. Implies `--decode-internal`. + + A flame graph is used to visualize which functions or operations + within the smart contract are consuming the most gas overall in a + sorted manner. --flamechart - Generate a flamechart for a single test. Implies `--decode-internal` - - --decode-internal [] - Whether to identify internal functions in traces. + Generate a flamechart for a single test. Implies `--decode-internal`. - If no argument is passed to this flag, it will trace internal - functions scope and decode stack parameters, but parameters stored in - memory (such as bytes or arrays) will not be decoded. + A flame chart shows the gas usage over time, illustrating when each + function is called (execution order) and how much gas it consumes at + each point in the timeline. + + --decode-internal [] + Identify internal functions in traces. - To decode memory parameters, you should pass an argument with a test - function name, similarly to --debug and --match-test. + This will trace internal functions and decode stack parameters. - If more than one test matches your specified criteria, you must add - additional filters until only one test is found (see --match-contract - and --match-path). + Parameters stored in memory (such as bytes or arrays) are currently + decoded only when a single function is matched, similarly to + `--debug`, for performance reasons. --gas-report Print a gas report diff --git a/src/reference/cli/forge/test.md b/src/reference/cli/forge/test.md index 127611c88..faabfdb5c 100644 --- a/src/reference/cli/forge/test.md +++ b/src/reference/cli/forge/test.md @@ -14,15 +14,8 @@ Options: Print help (see a summary with '-h') Test options: - --debug - Run a test in the debugger. - - The argument passed to this flag is the name of the test function you - want to run, and it works the same as --match-test. - - If more than one test matches your specified criteria, you must add - additional filters until only one test is found (see --match-contract - and --match-path). + --debug [] + Run a single test in the debugger. The matching test will be opened in the debugger regardless of the outcome of the test. @@ -30,29 +23,29 @@ Test options: 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 - run. --flamegraph - Generate a flamegraph for a single test. Implies `--decode-internal` + Generate a flamegraph for a single test. Implies `--decode-internal`. + + A flame graph is used to visualize which functions or operations + within the smart contract are consuming the most gas overall in a + sorted manner. --flamechart - Generate a flamechart for a single test. Implies `--decode-internal` - - --decode-internal [] - Whether to identify internal functions in traces. + Generate a flamechart for a single test. Implies `--decode-internal`. - If no argument is passed to this flag, it will trace internal - functions scope and decode stack parameters, but parameters stored in - memory (such as bytes or arrays) will not be decoded. + A flame chart shows the gas usage over time, illustrating when each + function is called (execution order) and how much gas it consumes at + each point in the timeline. + + --decode-internal [] + Identify internal functions in traces. - To decode memory parameters, you should pass an argument with a test - function name, similarly to --debug and --match-test. + This will trace internal functions and decode stack parameters. - If more than one test matches your specified criteria, you must add - additional filters until only one test is found (see --match-contract - and --match-path). + Parameters stored in memory (such as bytes or arrays) are currently + decoded only when a single function is matched, similarly to + `--debug`, for performance reasons. --gas-report Print a gas report diff --git a/src/reference/cli/forge/verify-check.md b/src/reference/cli/forge/verify-check.md index 79cf3c0d9..5cbd84433 100644 --- a/src/reference/cli/forge/verify-check.md +++ b/src/reference/cli/forge/verify-check.md @@ -24,7 +24,7 @@ Options: [default: 5] --delay - Optional delay to apply inbetween verification attempts, in seconds + Optional delay to apply in between verification attempts, in seconds [default: 5] diff --git a/src/reference/cli/forge/verify-contract.md b/src/reference/cli/forge/verify-contract.md index 99a78b24f..5ab3927ab 100644 --- a/src/reference/cli/forge/verify-contract.md +++ b/src/reference/cli/forge/verify-contract.md @@ -113,7 +113,7 @@ Options: [default: 5] --delay - Optional delay to apply inbetween verification attempts, in seconds + Optional delay to apply in between verification attempts, in seconds [default: 5] From 84b34cb857e25ec707eb8fca696d9e3a1b22422a Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:15:06 +0200 Subject: [PATCH 08/15] chore(output): weekly command output update (#1322) update command output Co-authored-by: zerosnacks --- src/output/cast/cast-call | 2 +- src/output/cheatcodes/forge-test-cheatcodes | 4 ++-- src/output/cheatcodes/forge-test-cheatcodes-expectrevert | 4 ++-- src/output/cheatcodes/forge-test-cheatcodes-tracing | 4 ++-- src/output/cheatcodes/forge-test-simple | 6 +++--- src/output/deps/forge-install | 2 +- src/output/foundry-template/forge-test | 4 ++-- src/output/fuzz_testing/forge-test-fail-fuzz | 8 ++++---- src/output/fuzz_testing/forge-test-no-fuzz | 6 +++--- src/output/fuzz_testing/forge-test-success-fuzz | 8 ++++---- src/output/hello_foundry/forge-build | 2 +- src/output/hello_foundry/forge-init | 4 ++-- src/output/hello_foundry/forge-test | 6 +++--- src/output/nft_tutorial/forge-test | 6 +++--- .../test_filters/forge-test-match-contract-and-test | 6 +++--- src/output/test_filters/forge-test-match-path | 6 +++--- src/reference/cli/forge/inspect.md | 6 +++--- src/reference/cli/forge/script.md | 2 +- 18 files changed, 43 insertions(+), 43 deletions(-) diff --git a/src/output/cast/cast-call b/src/output/cast/cast-call index d70b4efb8..e83f4ad94 100644 --- a/src/output/cast/cast-call +++ b/src/output/cast/cast-call @@ -3,6 +3,6 @@ $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf // ANCHOR_END: command // ANCHOR: output -3034745150676479763720898483 [3.034e27] +3090746321320665975308528818 [3.09e27] // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes b/src/output/cheatcodes/forge-test-cheatcodes index 36a403612..649ff74df 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes +++ b/src/output/cheatcodes/forge-test-cheatcodes @@ -8,8 +8,8 @@ No files changed, compilation skipped Ran 2 tests for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] testFail_IncrementAsNotOwner() (gas: 8314) [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 449.40µs (147.65µs CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 532.02µs (179.06µs CPU time) -Ran 1 test suite in 4.93ms (449.40µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.55ms (532.02µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert index ead65844d..ae9a98f5a 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert +++ b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert @@ -7,8 +7,8 @@ No files changed, compilation skipped Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 419.68µs (76.67µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 343.19µs (45.54µs CPU time) -Ran 1 test suite in 4.91ms (419.68µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.47ms (343.19µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-tracing b/src/output/cheatcodes/forge-test-cheatcodes-tracing index a16b8bc7e..46db9001d 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-tracing +++ b/src/output/cheatcodes/forge-test-cheatcodes-tracing @@ -15,8 +15,8 @@ Traces: │ └─ ← [Revert] Unauthorized() └─ ← [Revert] Unauthorized() -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 485.11µs (72.49µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 375.02µs (67.91µs CPU time) -Ran 1 test suite in 4.95ms (485.11µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.59ms (375.02µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-simple b/src/output/cheatcodes/forge-test-simple index 05d2d7259..2dd6a8b81 100644 --- a/src/output/cheatcodes/forge-test-simple +++ b/src/output/cheatcodes/forge-test-simple @@ -4,13 +4,13 @@ $ forge test --match-test test_IncrementAsOwner // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.14s +Solc 0.8.10 finished in 1.15s Compiler run successful! Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 419.24µs (51.86µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 437.53µs (45.94µs CPU time) -Ran 1 test suite in 4.84ms (419.24µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.70ms (437.53µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/deps/forge-install b/src/output/deps/forge-install index 875b02c2e..866d9e80f 100644 --- a/src/output/deps/forge-install +++ b/src/output/deps/forge-install @@ -3,7 +3,7 @@ $ forge install transmissions11/solmate // ANCHOR_END: command // ANCHOR: output -Installing solmate in /tmp/tmp.688D1rxuMB/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) +Installing solmate in /tmp/tmp.hVDGJnVOrL/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) Installed solmate // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-test b/src/output/foundry-template/forge-test index 5650b8268..75b676af7 100644 --- a/src/output/foundry-template/forge-test +++ b/src/output/foundry-template/forge-test @@ -9,8 +9,8 @@ Ran 3 tests for test/Foo.t.sol:FooTest [PASS] testFork_Example() (gas: 3779) [PASS] testFuzz_Example(uint256) (runs: 1000, μ: 9111, ~: 9111) [PASS] test_Example() (gas: 11861) -Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 21.62ms (21.42ms CPU time) +Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 20.35ms (20.11ms CPU time) -Ran 1 test suite in 22.57ms (21.62ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) +Ran 1 test suite in 21.35ms (20.35ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-fail-fuzz b/src/output/fuzz_testing/forge-test-fail-fuzz index c5450fb4e..bb9d61e75 100644 --- a/src/output/fuzz_testing/forge-test-fail-fuzz +++ b/src/output/fuzz_testing/forge-test-fail-fuzz @@ -4,13 +4,13 @@ $ forge test --allow-failure // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.11s +Solc 0.8.10 finished in 1.06s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[FAIL: EvmError: Revert; counterexample: calldata=0x29facca70000000000000000000000000000002f8f4586edd6d7cea729964c5bb9a01453 args=[16183711853851041747958787769756475724883 [1.618e40]]] testFuzz_Withdraw(uint256) (runs: 0, μ: 0, ~: 0) -Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 762.95µs (408.45µs CPU time) +[FAIL: EvmError: Revert; counterexample: calldata=0x29facca700000000001606d72c13b275c314f581654a986278bbdc04466e0f2775ba362b args=[9061267351168764350255870330477725971017994630945030562763126315 [9.061e63]]] testFuzz_Withdraw(uint256) (runs: 0, μ: 0, ~: 0) +Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 704.51µs (359.95µs CPU time) -Ran 1 test suite in 5.39ms (762.95µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.80ms (704.51µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-no-fuzz b/src/output/fuzz_testing/forge-test-no-fuzz index 5d70c25cc..7f252ca5f 100644 --- a/src/output/fuzz_testing/forge-test-no-fuzz +++ b/src/output/fuzz_testing/forge-test-no-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.15s +Solc 0.8.10 finished in 1.11s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest [PASS] test_Withdraw() (gas: 19463) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 393.78µs (38.23µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 432.86µs (57.92µs CPU time) -Ran 1 test suite in 5.07ms (393.78µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.60ms (432.86µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-success-fuzz b/src/output/fuzz_testing/forge-test-success-fuzz index b52082f23..0de3781dc 100644 --- a/src/output/fuzz_testing/forge-test-success-fuzz +++ b/src/output/fuzz_testing/forge-test-success-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.07s +Solc 0.8.10 finished in 1.14s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19266, ~: 19631) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 5.29ms (4.92ms CPU time) +[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19474, ~: 19631) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.94ms (4.63ms CPU time) -Ran 1 test suite in 6.17ms (5.29ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.82ms (4.94ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-build b/src/output/hello_foundry/forge-build index d31f2ca2f..d9f981044 100644 --- a/src/output/hello_foundry/forge-build +++ b/src/output/hello_foundry/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 27 files with Solc 0.8.19 -Solc 0.8.19 finished in 1.09s +Solc 0.8.19 finished in 1.11s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-init b/src/output/hello_foundry/forge-init index 553021d1b..02b890215 100644 --- a/src/output/hello_foundry/forge-init +++ b/src/output/hello_foundry/forge-init @@ -3,8 +3,8 @@ $ forge init hello_foundry // ANCHOR_END: command // ANCHOR: output -Initializing /tmp/tmp.NnQcg2Vq8E/hello_foundry... -Installing forge-std in /tmp/tmp.NnQcg2Vq8E/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) +Initializing /tmp/tmp.BkNKDgeiV6/hello_foundry... +Installing forge-std in /tmp/tmp.BkNKDgeiV6/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) Installed forge-std v1.9.3 Initialized forge project // ANCHOR_END: output diff --git a/src/output/hello_foundry/forge-test b/src/output/hello_foundry/forge-test index 6736701a1..3d8c9cf3b 100644 --- a/src/output/hello_foundry/forge-test +++ b/src/output/hello_foundry/forge-test @@ -6,10 +6,10 @@ $ forge test No files changed, compilation skipped Ran 2 tests for test/Counter.t.sol:CounterTest -[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 30899, ~: 31288) +[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 30977, ~: 31288) [PASS] test_Increment() (gas: 31303) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.15ms (7.83ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.61ms (8.25ms CPU time) -Ran 1 test suite in 9.00ms (8.15ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 9.53ms (8.61ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/nft_tutorial/forge-test b/src/output/nft_tutorial/forge-test index 23ee5c643..614035039 100644 --- a/src/output/nft_tutorial/forge-test +++ b/src/output/nft_tutorial/forge-test @@ -14,7 +14,7 @@ Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests [PASS] testMintPricePaid() (gas: 81554) [PASS] testNewMintOwnerRegistered() (gas: 190956) [PASS] testSafeContractReceiver() (gas: 273132) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.58ms (1.29ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.55ms (1.28ms CPU time) Ran 8 tests for test/SolmateNft.sol:SolmateNftTests [PASS] testBalanceIncremented() (gas: 217400) @@ -25,8 +25,8 @@ Ran 8 tests for test/SolmateNft.sol:SolmateNftTests [PASS] testMintPricePaid() (gas: 81321) [PASS] testNewMintOwnerRegistered() (gas: 190741) [PASS] testSafeContractReceiver() (gas: 272636) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.58ms (1.43ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.55ms (1.46ms CPU time) -Ran 2 test suites in 5.10ms (3.16ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) +Ran 2 test suites in 5.74ms (3.10ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-contract-and-test b/src/output/test_filters/forge-test-match-contract-and-test index f7e84d117..23801d522 100644 --- a/src/output/test_filters/forge-test-match-contract-and-test +++ b/src/output/test_filters/forge-test-match-contract-and-test @@ -4,14 +4,14 @@ $ forge test --match-contract ComplicatedContractTest --match-test test_Deposit // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.11s +Solc 0.8.10 finished in 1.09s Compiler run successful! Ran 2 tests for test/ComplicatedContract.t.sol:ComplicatedContractTest [PASS] test_DepositERC20() (gas: 102193) [PASS] test_DepositETH() (gas: 61414) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.14ms (1.49ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.05ms (1.43ms CPU time) -Ran 1 test suite in 5.32ms (1.14ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.90ms (1.05ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-path b/src/output/test_filters/forge-test-match-path index 4e261a607..15262e851 100644 --- a/src/output/test_filters/forge-test-match-path +++ b/src/output/test_filters/forge-test-match-path @@ -4,13 +4,13 @@ $ forge test --match-path test/ContractB.t.sol // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.05s +Solc 0.8.10 finished in 1.04s Compiler run successful! Ran 1 test for test/ContractB.t.sol:ContractBTest [PASS] testExample() (gas: 257) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 316.30µs (54.90µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 287.97µs (53.97µs CPU time) -Ran 1 test suite in 4.85ms (316.30µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.42ms (287.97µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/reference/cli/forge/inspect.md b/src/reference/cli/forge/inspect.md index efdb512aa..d2d910430 100644 --- a/src/reference/cli/forge/inspect.md +++ b/src/reference/cli/forge/inspect.md @@ -18,9 +18,9 @@ Arguments: The contract artifact field to inspect [possible values: abi, bytecode, deployedBytecode, assembly, - assemblyOptimized, methodIdentifiers, gasEstimates, storageLayout, - devdoc, ir, irOptimized, metadata, userdoc, ewasm, errors, events, - eof, eof-init] + legacyAssembly, assemblyOptimized, methodIdentifiers, gasEstimates, + storageLayout, devdoc, ir, irOptimized, metadata, userdoc, ewasm, + errors, events, eof, eof-init] Options: --pretty diff --git a/src/reference/cli/forge/script.md b/src/reference/cli/forge/script.md index 134c624dc..17dc138c2 100644 --- a/src/reference/cli/forge/script.md +++ b/src/reference/cli/forge/script.md @@ -291,7 +291,7 @@ Wallet options - raw: Wallet options - keystore: --keystore - Use the keystore in the given folder or file + Use the keystore by its filename in the given folder [env: ETH_KEYSTORE=] [aliases: keystores] From 2e37c3eb8e117e16ffe17642d13f91ad4717719b Mon Sep 17 00:00:00 2001 From: zerosnacks <95942363+zerosnacks@users.noreply.github.com> Date: Thu, 3 Oct 2024 13:24:25 +0200 Subject: [PATCH 09/15] feat: document gas snapshot cheatcodes (#1323) * add gas snapshots, update state snapshots * embed cheatcodes * link to cheatcodes * update description --- src/SUMMARY.md | 6 +- src/cheatcodes/gas-snapshots.md | 175 ++++++++++++++++++ src/cheatcodes/snapshots.md | 63 ------- src/cheatcodes/state-snapshots.md | 81 ++++++++ ...snapshots.md => gas-function-snapshots.md} | 2 +- src/forge/gas-section-snapshots.md | 7 + src/forge/gas-tracking.md | 14 +- 7 files changed, 277 insertions(+), 71 deletions(-) create mode 100644 src/cheatcodes/gas-snapshots.md delete mode 100644 src/cheatcodes/snapshots.md create mode 100644 src/cheatcodes/state-snapshots.md rename src/forge/{gas-snapshots.md => gas-function-snapshots.md} (99%) create mode 100644 src/forge/gas-section-snapshots.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 7d78e634a..336c90cfb 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -39,7 +39,8 @@ - [Deploying and Verifying](./forge/deploying.md) - [Gas Tracking](./forge/gas-tracking.md) - [Gas Reports](./forge/gas-reports.md) - - [Gas Snapshots](./forge/gas-snapshots.md) + - [Gas Function Snapshots](./forge/gas-function-snapshots.md) + - [Gas Section Snapshots](./forge/gas-section-snapshots.md) - [Debugger](./forge/debugger.md) # Cast Overview @@ -429,6 +430,8 @@ - [`txGasPrice`](./cheatcodes/tx-gas-price.md) - [`startStateDiffRecording`](./cheatcodes/start-state-diff-recording.md) - [`stopAndReturnStateDiff`](./cheatcodes/stop-and-return-state-diff.md) + - [`snapshotState`](./cheatcodes/state-snapshots.md) + - [`snapshotGas`](./cheatcodes/gas-snapshots.md) - [Assertions](./cheatcodes/assertions.md) - [`expectRevert`](./cheatcodes/expect-revert.md) - [`expectEmit`](./cheatcodes/expect-emit.md) @@ -493,7 +496,6 @@ - [`createWallet`](./cheatcodes/create-wallet.md) - [`copyStorage`](./cheatcodes/copy-storage.md) - [`setArbitraryStorage`](./cheatcodes/set-arbitrary-storage.md) - - [Snapshots](./cheatcodes/snapshots.md) - [RPC](./cheatcodes/rpc.md) - [Files](./cheatcodes/fs.md) - [Forge Standard Library Reference](./reference/forge-std/README.md) diff --git a/src/cheatcodes/gas-snapshots.md b/src/cheatcodes/gas-snapshots.md new file mode 100644 index 000000000..5f14dcf58 --- /dev/null +++ b/src/cheatcodes/gas-snapshots.md @@ -0,0 +1,175 @@ +## `snapshotGas` cheatcodes + +### Signature + +```solidity +/// Start a snapshot capture of the current gas usage by name. +/// The group name is derived from the contract name. +function startSnapshotGas(string calldata name) external; + +/// Start a snapshot capture of the current gas usage by name in a group. +function startSnapshotGas(string calldata group, string calldata name) external; + +/// Stop the snapshot capture of the current gas by latest snapshot name, capturing the gas used since the start. +function stopSnapshotGas() external returns (uint256 gasUsed); + +/// Stop the snapshot capture of the current gas usage by name, capturing the gas used since the start. +/// The group name is derived from the contract name. +function stopSnapshotGas(string calldata name) external returns (uint256 gasUsed); + +/// Stop the snapshot capture of the current gas usage by name in a group, capturing the gas used since the start. +function stopSnapshotGas(string calldata group, string calldata name) external returns (uint256 gasUsed); + +/// Snapshot capture an arbitrary numerical value by name. +/// The group name is derived from the contract name. +function snapshotValue(string calldata name, uint256 value) external; + +/// Snapshot capture an arbitrary numerical value by name in a group. +function snapshotValue(string calldata group, string calldata name, uint256 value) external; + +/// Snapshot capture the gas usage of the last call by name from the callee perspective. +function snapshotGasLastCall(string calldata name) external returns (uint256 gasUsed); + +/// Snapshot capture the gas usage of the last call by name in a group from the callee perspective. +function snapshotGasLastCall(string calldata group, string calldata name) external returns (uint256 gasUsed); +``` + +### Description + +`snapshotGas*` cheatcodes allow you to capture gas usage in your tests. This can be useful to track how much gas your logic is consuming. You can capture the gas usage of the last call by name, capture an arbitrary numerical value by name, or start and stop a snapshot capture of the current gas usage by name. + +In order to strictly compare gas usage across test runs, set the `FORGE_SNAPSHOT_CHECK` environment variable to `true` before running your tests. This will compare the gas usage of your tests against the last snapshot and fail if the gas usage has changed. By default the snapshots directory will be newly created and its contents removed before each test run to ensure no stale data is present. + +It is intended that the `snapshots` directory created when using the `snapshotGas*` cheatcodes is checked into version control. This allows you to track changes in gas usage over time and compare gas usage during code reviews. + +When running `forge clean` the `snapshots` directory will be deleted. + +### Examples + +Capturing the gas usage of a section of code that calls an external contract: + +```solidity +contract SnapshotGasTest is Test { + uint256 public slot0; + + Flare public flare; + + function setUp() public { + flare = new Flare(); + } + + function testSnapshotGas() public { + vm.startSnapshotGas("externalA"); + flare.run(256); + uint256 gasUsed = vm.stopSnapshotGas(); + } +} +``` + +Capturing the gas usage of multiple sections of code that modify the internal state: + + +```solidity +contract SnapshotGasTest is Test { + uint256 public slot0; + + + /// Writes to `snapshots/SnapshotGasTest.json` group with name `internalA`, `internalB`, and `internalC`. + function testSnapshotGas() public { + vm.startSnapshotGas("internalA"); + slot0 = 1; + vm.stopSnapshotGas(); + + vm.startSnapshotGas("internalB"); + slot0 = 2; + vm.stopSnapshotGas(); + + vm.startSnapshotGas("internalC"); + slot0 = 0; + vm.stopSnapshotGas(); + } +} +``` + +Capturing the gas usage of a section of code that modifies both the internal state and calls an external contract: + +```solidity +contract SnapshotGasTest is Test { + uint256 public slot0; + Flare public flare; + + function setUp() public { + flare = new Flare(); + } + + /// Writes to `snapshots/SnapshotGasTest.json` group with name `combinedA`. + function testSnapshotGas() public { + vm.startSnapshotGas("combinedA"); + flare.run(256); + slot0 = 1; + vm.stopSnapshotGas(); + } +} +``` + +```solidity + +Capturing an arbitrary numerical value (such as the bytecode size of a contract): + +```solidity +contract SnapshotGasTest is Test { + uint256 public slot0; + + /// Writes to `snapshots/SnapshotGasTest.json` group with name `valueA`, `valueB`, and `valueC`. + function testSnapshotValue() public { + uint256 a = 123; + uint256 b = 456; + uint256 c = 789; + + vm.snapshotValue("valueA", a); + vm.snapshotValue("valueB", b); + vm.snapshotValue("valueC", c); + } +} +``` + +Capturing the gas usage of the last call from the callee perspective: + +```solidity +contract SnapshotGasTest is Test { + Flare public flare; + + function setUp() public { + flare = new Flare(); + } + + /// Writes to `snapshots/SnapshotGasTest.json` group with name `lastCallA`. + function testSnapshotGasLastCall() public { + flare.run(1); + vm.snapshotGasLastCall("lastCallA"); + } +} +``` + +For each of the above examples you can also use the `group` variant of the cheatcodes to group the snapshots together in a custom group. + +```solidity +contract SnapshotGasTest is Test { + uint256 public slot0; + + /// Writes to `snapshots/CustomGroup.json` group with name `internalA`, `internalB`, and `internalC`. + function testSnapshotGas() public { + vm.startSnapshotGas("CustomGroup", "internalA"); + slot0 = 1; + vm.stopSnapshotGas(); + + vm.startSnapshotGas("CustomGroup", "internalB"); + slot0 = 2; + vm.stopSnapshotGas(); + + vm.startSnapshotGas("CustomGroup", "internalC"); + slot0 = 0; + vm.stopSnapshotGas(); + } +} +``` diff --git a/src/cheatcodes/snapshots.md b/src/cheatcodes/snapshots.md deleted file mode 100644 index 147121154..000000000 --- a/src/cheatcodes/snapshots.md +++ /dev/null @@ -1,63 +0,0 @@ -## snapshot cheatcodes - -### Signature - -```solidity -// Snapshot the current state of the evm. -// Returns the id of the snapshot that was created. -// To revert a snapshot use `revertTo` -function snapshot() external returns(uint256); -// Revert the state of the evm to a previous snapshot -// Takes the snapshot id to revert to. -// This deletes the snapshot and all snapshots taken after the given snapshot id. -function revertTo(uint256) external returns(bool); -``` - -### Description - -`snapshot` takes a snapshot of the state of the blockchain and returns the identifier of the created snapshot - -`revertTo` reverts the state of the blockchain to the given snapshot. This deletes the given snapshot, as well as any snapshots taken after (e.g.: reverting to id 2 will delete snapshots with ids 2, 3, 4, etc.) - -### Examples - -```solidity -struct Storage { - uint slot0; - uint slot1; -} - -contract SnapshotTest is Test { - Storage store; - uint256 timestamp; - - function setUp() public { - store.slot0 = 10; - store.slot1 = 20; - vm.deal(address(this), 5 ether); // balance = 5 ether - timestamp = block.timestamp; - } - - function testSnapshot() public { - uint256 snapshot = vm.snapshot(); // saves the state - - // let's change the state - store.slot0 = 300; - store.slot1 = 400; - vm.deal(address(this), 500 ether); - vm.warp(12345); // block.timestamp = 12345 - - assertEq(store.slot0, 300); - assertEq(store.slot1, 400); - assertEq(address(this).balance, 500 ether); - assertEq(block.timestamp, 12345); - - vm.revertTo(snapshot); // restores the state - - assertEq(store.slot0, 10, "snapshot revert for slot 0 unsuccessful"); - assertEq(store.slot1, 20, "snapshot revert for slot 1 unsuccessful"); - assertEq(address(this).balance, 5 ether, "snapshot revert for balance unsuccessful"); - assertEq(block.timestamp, timestamp, "snapshot revert for timestamp unsuccessful"); - } -} -``` diff --git a/src/cheatcodes/state-snapshots.md b/src/cheatcodes/state-snapshots.md new file mode 100644 index 000000000..abb615939 --- /dev/null +++ b/src/cheatcodes/state-snapshots.md @@ -0,0 +1,81 @@ +## `snapshotState` cheatcodes + +### Signature + +```solidity +/// Snapshot the current state of the evm. +/// Returns the ID of the snapshot that was created. +/// To revert a snapshot use `revertToState`. +function snapshotState() external returns (uint256 snapshotId); + +/// Revert the state of the EVM to a previous snapshot +/// Takes the snapshot ID to revert to. +/// Returns `true` if the snapshot was successfully reverted. +/// Returns `false` if the snapshot does not exist. +/// **Note:** This does not automatically delete the snapshot. To delete the snapshot use `deleteStateSnapshot`. +function revertToState(uint256 snapshotId) external returns (bool success); + +/// Revert the state of the EVM to a previous snapshot and automatically deletes the snapshots +/// Takes the snapshot ID to revert to. +/// Returns `true` if the snapshot was successfully reverted and deleted. +/// Returns `false` if the snapshot does not exist. +function revertToStateAndDelete(uint256 snapshotId) external returns (bool success); + +/// Removes the snapshot with the given ID created by `snapshot`. +/// Takes the snapshot ID to delete. +/// Returns `true` if the snapshot was successfully deleted. +/// Returns `false` if the snapshot does not exist. +function deleteStateSnapshot(uint256 snapshotId) external returns (bool success); + +/// Removes _all_ snapshots previously created by `snapshot`. +function deleteStateSnapshots() external; +``` + +### Description + +`snapshotState` takes a snapshot of the state of the blockchain and returns the identifier of the created snapshot. + +`revertToState` reverts the state of the blockchain to the given state snapshot. This deletes the given snapshot, as well as any snapshots taken after (e.g.: reverting to id 2 will delete snapshots with ids 2, 3, 4, etc.). + +### Examples + +```solidity +struct Storage { + uint slot0; + uint slot1; +} + +contract SnapshotStateTest is Test { + Storage store; + uint256 timestamp; + + function setUp() public { + store.slot0 = 10; + store.slot1 = 20; + vm.deal(address(this), 5 ether); // balance = 5 ether + timestamp = block.timestamp; + } + + function testSnapshotState() public { + uint256 snapshot = vm.snapshotState(); // saves the state + + // let's change the state + store.slot0 = 300; + store.slot1 = 400; + vm.deal(address(this), 500 ether); + vm.warp(12345); // block.timestamp = 12345 + + assertEq(store.slot0, 300); + assertEq(store.slot1, 400); + assertEq(address(this).balance, 500 ether); + assertEq(block.timestamp, 12345); + + vm.revertToState(snapshot); // restores the state + + assertEq(store.slot0, 10, "snapshot revert for slot 0 unsuccessful"); + assertEq(store.slot1, 20, "snapshot revert for slot 1 unsuccessful"); + assertEq(address(this).balance, 5 ether, "snapshot revert for balance unsuccessful"); + assertEq(block.timestamp, timestamp, "snapshot revert for timestamp unsuccessful"); + } +} +``` diff --git a/src/forge/gas-snapshots.md b/src/forge/gas-function-snapshots.md similarity index 99% rename from src/forge/gas-snapshots.md rename to src/forge/gas-function-snapshots.md index b155e95f2..6d2faded6 100644 --- a/src/forge/gas-snapshots.md +++ b/src/forge/gas-function-snapshots.md @@ -1,4 +1,4 @@ -## Gas Snapshots +## Gas Function Snapshots Forge can generate gas snapshots for all your test functions. This can be useful to get a general feel for how much gas your contract will consume, diff --git a/src/forge/gas-section-snapshots.md b/src/forge/gas-section-snapshots.md new file mode 100644 index 000000000..7f8318ead --- /dev/null +++ b/src/forge/gas-section-snapshots.md @@ -0,0 +1,7 @@ +# Gas Section Snapshots + +Forge can capture gas snapshots over arbitrary sections inside of your test functions. This can be useful to get a granular measurement of how much gas your logic is consuming as both external calls and internal gas usage are measured. + +Instead of running a command like `forge snapshot` or `forge test --gas-report`, you use the `snapshotGas` [cheatcodes](./cheatcodes.md) in your tests to capture gas usage as follows: + +{{#include ../cheatcodes/gas-snapshots.md}} \ No newline at end of file diff --git a/src/forge/gas-tracking.md b/src/forge/gas-tracking.md index d18bc7f70..2d43783d8 100644 --- a/src/forge/gas-tracking.md +++ b/src/forge/gas-tracking.md @@ -2,16 +2,20 @@ Forge can help you estimate how much gas your contract will consume. -Currently, Forge ships with two different tools for this job, but they may be merged in the future: +Currently, Forge ships with three different tools for this job: - [**Gas reports**](./gas-reports.md): Gas reports give you an overview of how much Forge thinks the individual functions in your contracts will consume in gas. -- [**Gas snapshots**](./gas-snapshots.md): Gas snapshots give you an overview of how much - each test consumes in gas. +- [**Gas function snapshots**](./gas-function-snapshots.md): Gas function snapshots give you an overview of how much + each test function consumes in gas. +- [**Gas section snapshots**](./gas-section-snapshots.md): Gas section snapshots give you the ability to capture gas usage over arbitrary sections inside of test functions. + This also tracks internal gas usage. You can access this by using the `snapshotGas*` cheatcodes inside your tests. -Gas reports and gas snapshots differ in some ways: +Gas reports, gas function snapshots and gas section snapshots differ in some ways: - Gas reports use tracing to figure out gas costs for individual contract calls. This gives more granular insight, at the cost of speed. -- Gas snapshots have more built-in tools, such as diffs and exporting the results to a file. +- Gas function snapshots have more built-in tools, such as diffs and exporting the results to a file. Snapshots are not as granular as gas reports, but they are faster to generate. +- Gas section snapshots provides the most granular way to capture gas usage. Every captured gas snapshot is written to a file in a `snapshots` directory. + By default these snapshots are grouped by the contract name of the test. \ No newline at end of file From e3655ff7837d614bc5e7b1dbc4f51b1ee1959bce Mon Sep 17 00:00:00 2001 From: Ata Tekeli Date: Fri, 4 Oct 2024 17:23:59 +0300 Subject: [PATCH 10/15] doc: add ci-cd folder and add github-actions to the folder (#1326) --- src/ci-cd/github-actions.md | 104 ++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/ci-cd/github-actions.md diff --git a/src/ci-cd/github-actions.md b/src/ci-cd/github-actions.md new file mode 100644 index 000000000..7aed5a6a2 --- /dev/null +++ b/src/ci-cd/github-actions.md @@ -0,0 +1,104 @@ +# Overview of `foundry-toolchain` + +`foundry-toolchain` can be used to install Foundry for GitHub Actions build processes. + +### Example workflow + +``` +on: [push] + +name: test + +jobs: + check: + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Run tests + run: forge test -vvv + + - name: Run snapshot + run: forge snapshot +``` + +### Inputs + +| Name | Required | Default | Description | Type | +|---|---|---|---|---| +| cache | No | true | Whether to cache RPC responses or not. | bool | +| version | No | nightly | Version to install, e.g. nightly or 1.8.8. Note: Foundry only has nightly builds for the time being. | string | +| cache-key | No | `${{ github.job }}` | The cache key to use for caching. | string | +| cache-restore-keys | No | `[${{ github.job }}]` | The cache keys to use for restoring the cache. | string[] | + +### RPC Caching + +By default, this action matches Forge's behavior and caches all RPC responses in the `~/.foundry/cache/rpc` directory. This is done to speed up the tests and avoid hitting the rate limit of your RPC provider. + +The logic of the caching is as follows: + +- Always load the latest valid cache, and always create a new one with the updated cache. +- When there are no changes to the fork tests, the cache does not change but the key does, since the key is based on the commit hash. +- When the fork tests are changed, both the cache and the key are updated. + +If you would like to disable the caching (e.g. because you want to implement your own caching mechanism), you can set the `cache` input to `false`, like this: + +``` +- name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + cache: false +``` + +### Custom Cache Keys + +You have the ability to define custom cache keys by utilizing the `cache-key` and `cache-restore-keys` inputs. This feature is particularly beneficial when you aim to tailor the cache-sharing strategy across multiple jobs. It is important to ensure that the cache-key is unique for each execution to prevent conflicts and guarantee successful cache saving. + +For instance, if you wish to utilize a shared cache between two distinct jobs, the following configuration can be applied: + +``` +- name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + cache-key: custom-seed-test-${{ github.sha }} + cache-restore-keys: |- + custom-seed-test- + custom-seed- +--- +- name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + with: + cache-key: custom-seed-coverage-${{ github.sha }} + cache-restore-keys: |- + custom-seed-coverage- + custom-seed- +``` + +#### Deleting Caches + +You can delete caches via the GitHub Actions user interface. Just go to your repo's "Actions" page: + +`https://github.com///actions/caches` + +Then, locate the "Management" section, and click on "Caches". You will see a list of all of your current caches, which you can delete by clicking on the trash icon. + +#### Fuzzing + +Note that if you are fuzzing in your fork tests, the RPC cache strategy above will not work unless you set a [fuzz seed](https://book.getfoundry.sh/reference/config/testing#seed). You might also want to reduce your number of RPC calls by using [Multicall](https://github.com/mds1/multicall). + +### Summaries + +You can add the output of Forge and Cast commands to GitHub step summaries. The summaries support GitHub flavored Markdown. + +For example, to add the output of `forge snapshot` to a summary, you would change the snapshot step to: + +``` +- name: Run snapshot + run: NO_COLOR=1 forge snapshot >> $GITHUB_STEP_SUMMARY +``` \ No newline at end of file From 27b9beb074cff8ce0d11157a6b144fcd51fed20b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 6 Oct 2024 04:26:31 +0200 Subject: [PATCH 11/15] chore(output): weekly command output update (#1327) update command output Co-authored-by: mattsse --- src/output/cast/cast-call | 2 +- src/output/cheatcodes/forge-test-cheatcodes | 4 +-- .../forge-test-cheatcodes-expectrevert | 4 +-- .../cheatcodes/forge-test-cheatcodes-tracing | 4 +-- src/output/cheatcodes/forge-test-simple | 6 ++--- src/output/deps/forge-install | 2 +- src/output/foundry-template/forge-build | 2 +- src/output/foundry-template/forge-test | 4 +-- src/output/fuzz_testing/forge-test-fail-fuzz | 8 +++--- src/output/fuzz_testing/forge-test-no-fuzz | 6 ++--- .../fuzz_testing/forge-test-success-fuzz | 8 +++--- src/output/hello_foundry/forge-build | 2 +- src/output/hello_foundry/forge-init | 4 +-- src/output/hello_foundry/forge-test | 6 ++--- src/output/nft_tutorial/forge-test | 26 +++++++++---------- .../forge-test-match-contract-and-test | 6 ++--- src/output/test_filters/forge-test-match-path | 6 ++--- src/reference/cli/cast/storage.md | 7 +++++ src/reference/cli/chisel.md | 7 +++++ src/reference/cli/forge/bind-json.md | 7 +++++ src/reference/cli/forge/bind.md | 7 +++++ src/reference/cli/forge/build.md | 7 +++++ src/reference/cli/forge/config.md | 7 +++++ src/reference/cli/forge/coverage.md | 7 +++++ src/reference/cli/forge/create.md | 7 +++++ src/reference/cli/forge/debug.md | 7 +++++ src/reference/cli/forge/eip712.md | 7 +++++ src/reference/cli/forge/inspect.md | 7 +++++ src/reference/cli/forge/script.md | 7 +++++ .../cli/forge/selectors/collision.md | 7 +++++ src/reference/cli/forge/snapshot.md | 7 +++++ src/reference/cli/forge/test.md | 7 +++++ 32 files changed, 155 insertions(+), 50 deletions(-) diff --git a/src/output/cast/cast-call b/src/output/cast/cast-call index e83f4ad94..7368f359c 100644 --- a/src/output/cast/cast-call +++ b/src/output/cast/cast-call @@ -3,6 +3,6 @@ $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf // ANCHOR_END: command // ANCHOR: output -3090746321320665975308528818 [3.09e27] +3109318878827982953647909191 [3.109e27] // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes b/src/output/cheatcodes/forge-test-cheatcodes index 649ff74df..e9bd50090 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes +++ b/src/output/cheatcodes/forge-test-cheatcodes @@ -8,8 +8,8 @@ No files changed, compilation skipped Ran 2 tests for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] testFail_IncrementAsNotOwner() (gas: 8314) [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 532.02µs (179.06µs CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 452.51µs (122.03µs CPU time) -Ran 1 test suite in 5.55ms (532.02µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 6.31ms (452.51µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert index ae9a98f5a..e842035fb 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert +++ b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert @@ -7,8 +7,8 @@ No files changed, compilation skipped Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 343.19µs (45.54µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 372.89µs (51.00µs CPU time) -Ran 1 test suite in 5.47ms (343.19µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.55ms (372.89µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-tracing b/src/output/cheatcodes/forge-test-cheatcodes-tracing index 46db9001d..8ecba2856 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-tracing +++ b/src/output/cheatcodes/forge-test-cheatcodes-tracing @@ -15,8 +15,8 @@ Traces: │ └─ ← [Revert] Unauthorized() └─ ← [Revert] Unauthorized() -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 375.02µs (67.91µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 401.29µs (61.48µs CPU time) -Ran 1 test suite in 5.59ms (375.02µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.77ms (401.29µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-simple b/src/output/cheatcodes/forge-test-simple index 2dd6a8b81..83e8a50e0 100644 --- a/src/output/cheatcodes/forge-test-simple +++ b/src/output/cheatcodes/forge-test-simple @@ -4,13 +4,13 @@ $ forge test --match-test test_IncrementAsOwner // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.15s +Solc 0.8.10 finished in 1.14s Compiler run successful! Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 437.53µs (45.94µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 483.66µs (81.45µs CPU time) -Ran 1 test suite in 5.70ms (437.53µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.56ms (483.66µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/deps/forge-install b/src/output/deps/forge-install index 866d9e80f..edcfeb7e2 100644 --- a/src/output/deps/forge-install +++ b/src/output/deps/forge-install @@ -3,7 +3,7 @@ $ forge install transmissions11/solmate // ANCHOR_END: command // ANCHOR: output -Installing solmate in /tmp/tmp.hVDGJnVOrL/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) +Installing solmate in /tmp/tmp.75JYewHG5d/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) Installed solmate // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-build b/src/output/foundry-template/forge-build index 2c04f92c7..546d405dd 100644 --- a/src/output/foundry-template/forge-build +++ b/src/output/foundry-template/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 28 files with Solc 0.8.25 -Solc 0.8.25 finished in 1.34s +Solc 0.8.25 finished in 1.35s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-test b/src/output/foundry-template/forge-test index 75b676af7..309e012f5 100644 --- a/src/output/foundry-template/forge-test +++ b/src/output/foundry-template/forge-test @@ -9,8 +9,8 @@ Ran 3 tests for test/Foo.t.sol:FooTest [PASS] testFork_Example() (gas: 3779) [PASS] testFuzz_Example(uint256) (runs: 1000, μ: 9111, ~: 9111) [PASS] test_Example() (gas: 11861) -Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 20.35ms (20.11ms CPU time) +Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 19.97ms (19.77ms CPU time) -Ran 1 test suite in 21.35ms (20.35ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) +Ran 1 test suite in 20.94ms (19.97ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-fail-fuzz b/src/output/fuzz_testing/forge-test-fail-fuzz index bb9d61e75..26b123f67 100644 --- a/src/output/fuzz_testing/forge-test-fail-fuzz +++ b/src/output/fuzz_testing/forge-test-fail-fuzz @@ -4,13 +4,13 @@ $ forge test --allow-failure // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.06s +Solc 0.8.10 finished in 1.08s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[FAIL: EvmError: Revert; counterexample: calldata=0x29facca700000000001606d72c13b275c314f581654a986278bbdc04466e0f2775ba362b args=[9061267351168764350255870330477725971017994630945030562763126315 [9.061e63]]] testFuzz_Withdraw(uint256) (runs: 0, μ: 0, ~: 0) -Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 704.51µs (359.95µs CPU time) +[FAIL: EvmError: Revert; counterexample: calldata=0x29facca7000000000000000001d8dbee6aa2fb9b6fd5be77d33b906c7c8636a2197258e5 args=[45290904529516386323350766163740848821611920638889580773 [4.529e55]]] testFuzz_Withdraw(uint256) (runs: 1, μ: 19531, ~: 19531) +Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 822.82µs (476.78µs CPU time) -Ran 1 test suite in 5.80ms (704.51µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) +Ran 1 test suite in 6.70ms (822.82µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-no-fuzz b/src/output/fuzz_testing/forge-test-no-fuzz index 7f252ca5f..052f29ceb 100644 --- a/src/output/fuzz_testing/forge-test-no-fuzz +++ b/src/output/fuzz_testing/forge-test-no-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.11s +Solc 0.8.10 finished in 1.13s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest [PASS] test_Withdraw() (gas: 19463) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 432.86µs (57.92µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 404.34µs (52.05µs CPU time) -Ran 1 test suite in 5.60ms (432.86µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.44ms (404.34µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-success-fuzz b/src/output/fuzz_testing/forge-test-success-fuzz index 0de3781dc..38550ac6a 100644 --- a/src/output/fuzz_testing/forge-test-success-fuzz +++ b/src/output/fuzz_testing/forge-test-success-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.14s +Solc 0.8.10 finished in 1.08s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19474, ~: 19631) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.94ms (4.63ms CPU time) +[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19318, ~: 19631) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.95ms (4.59ms CPU time) -Ran 1 test suite in 5.82ms (4.94ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.85ms (4.95ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-build b/src/output/hello_foundry/forge-build index d9f981044..102149945 100644 --- a/src/output/hello_foundry/forge-build +++ b/src/output/hello_foundry/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 27 files with Solc 0.8.19 -Solc 0.8.19 finished in 1.11s +Solc 0.8.19 finished in 1.10s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-init b/src/output/hello_foundry/forge-init index 02b890215..bc98d2b58 100644 --- a/src/output/hello_foundry/forge-init +++ b/src/output/hello_foundry/forge-init @@ -3,8 +3,8 @@ $ forge init hello_foundry // ANCHOR_END: command // ANCHOR: output -Initializing /tmp/tmp.BkNKDgeiV6/hello_foundry... -Installing forge-std in /tmp/tmp.BkNKDgeiV6/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) +Initializing /tmp/tmp.ZzvYQlcflC/hello_foundry... +Installing forge-std in /tmp/tmp.ZzvYQlcflC/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) Installed forge-std v1.9.3 Initialized forge project // ANCHOR_END: output diff --git a/src/output/hello_foundry/forge-test b/src/output/hello_foundry/forge-test index 3d8c9cf3b..60559ae08 100644 --- a/src/output/hello_foundry/forge-test +++ b/src/output/hello_foundry/forge-test @@ -6,10 +6,10 @@ $ forge test No files changed, compilation skipped Ran 2 tests for test/Counter.t.sol:CounterTest -[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 30977, ~: 31288) +[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 31210, ~: 31288) [PASS] test_Increment() (gas: 31303) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.61ms (8.25ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.48ms (8.17ms CPU time) -Ran 1 test suite in 9.53ms (8.61ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 9.35ms (8.48ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/nft_tutorial/forge-test b/src/output/nft_tutorial/forge-test index 614035039..fadd636c5 100644 --- a/src/output/nft_tutorial/forge-test +++ b/src/output/nft_tutorial/forge-test @@ -5,17 +5,6 @@ $ forge test // ANCHOR: output No files changed, compilation skipped -Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests -[PASS] testBalanceIncremented() (gas: 217829) -[PASS] testFailMaxSupplyReached() (gas: 134524) -[PASS] testFailMintToZeroAddress() (gas: 34577) -[PASS] testFailNoMintPricePaid() (gas: 5568) -[PASS] testFailUnSafeContractReceiver() (gas: 3524) -[PASS] testMintPricePaid() (gas: 81554) -[PASS] testNewMintOwnerRegistered() (gas: 190956) -[PASS] testSafeContractReceiver() (gas: 273132) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.55ms (1.28ms CPU time) - Ran 8 tests for test/SolmateNft.sol:SolmateNftTests [PASS] testBalanceIncremented() (gas: 217400) [PASS] testFailMaxSupplyReached() (gas: 134524) @@ -25,8 +14,19 @@ Ran 8 tests for test/SolmateNft.sol:SolmateNftTests [PASS] testMintPricePaid() (gas: 81321) [PASS] testNewMintOwnerRegistered() (gas: 190741) [PASS] testSafeContractReceiver() (gas: 272636) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.55ms (1.46ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.71ms (1.32ms CPU time) + +Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests +[PASS] testBalanceIncremented() (gas: 217829) +[PASS] testFailMaxSupplyReached() (gas: 134524) +[PASS] testFailMintToZeroAddress() (gas: 34577) +[PASS] testFailNoMintPricePaid() (gas: 5568) +[PASS] testFailUnSafeContractReceiver() (gas: 3524) +[PASS] testMintPricePaid() (gas: 81554) +[PASS] testNewMintOwnerRegistered() (gas: 190956) +[PASS] testSafeContractReceiver() (gas: 273132) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.72ms (2.07ms CPU time) -Ran 2 test suites in 5.74ms (3.10ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) +Ran 2 test suites in 5.75ms (3.44ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-contract-and-test b/src/output/test_filters/forge-test-match-contract-and-test index 23801d522..a60920fbf 100644 --- a/src/output/test_filters/forge-test-match-contract-and-test +++ b/src/output/test_filters/forge-test-match-contract-and-test @@ -4,14 +4,14 @@ $ forge test --match-contract ComplicatedContractTest --match-test test_Deposit // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.09s +Solc 0.8.10 finished in 1.12s Compiler run successful! Ran 2 tests for test/ComplicatedContract.t.sol:ComplicatedContractTest [PASS] test_DepositERC20() (gas: 102193) [PASS] test_DepositETH() (gas: 61414) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.05ms (1.43ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.34ms (1.43ms CPU time) -Ran 1 test suite in 5.90ms (1.05ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.73ms (1.34ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-path b/src/output/test_filters/forge-test-match-path index 15262e851..41bbfaea4 100644 --- a/src/output/test_filters/forge-test-match-path +++ b/src/output/test_filters/forge-test-match-path @@ -4,13 +4,13 @@ $ forge test --match-path test/ContractB.t.sol // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.04s +Solc 0.8.10 finished in 1.05s Compiler run successful! Ran 1 test for test/ContractB.t.sol:ContractBTest [PASS] testExample() (gas: 257) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 287.97µs (53.97µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 310.04µs (56.68µs CPU time) -Ran 1 test suite in 5.42ms (287.97µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.38ms (310.04µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/reference/cli/cast/storage.md b/src/reference/cli/cast/storage.md index 2ee5cab13..92e1af80b 100644 --- a/src/reference/cli/cast/storage.md +++ b/src/reference/cli/cast/storage.md @@ -71,6 +71,13 @@ 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. diff --git a/src/reference/cli/chisel.md b/src/reference/cli/chisel.md index 204d837ed..776503ae0 100644 --- a/src/reference/cli/chisel.md +++ b/src/reference/cli/chisel.md @@ -45,6 +45,13 @@ 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. diff --git a/src/reference/cli/forge/bind-json.md b/src/reference/cli/forge/bind-json.md index ff59ebcd1..4261b09d3 100644 --- a/src/reference/cli/forge/bind-json.md +++ b/src/reference/cli/forge/bind-json.md @@ -25,6 +25,13 @@ 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. diff --git a/src/reference/cli/forge/bind.md b/src/reference/cli/forge/bind.md index 8d702a995..f1ab0503f 100644 --- a/src/reference/cli/forge/bind.md +++ b/src/reference/cli/forge/bind.md @@ -81,6 +81,13 @@ 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. diff --git a/src/reference/cli/forge/build.md b/src/reference/cli/forge/build.md index ff1b9b2a5..74f10ac07 100644 --- a/src/reference/cli/forge/build.md +++ b/src/reference/cli/forge/build.md @@ -23,6 +23,13 @@ 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. diff --git a/src/reference/cli/forge/config.md b/src/reference/cli/forge/config.md index c788c9802..3b48ac486 100644 --- a/src/reference/cli/forge/config.md +++ b/src/reference/cli/forge/config.md @@ -32,6 +32,13 @@ 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. diff --git a/src/reference/cli/forge/coverage.md b/src/reference/cli/forge/coverage.md index 7da203273..4c31c8750 100644 --- a/src/reference/cli/forge/coverage.md +++ b/src/reference/cli/forge/coverage.md @@ -315,6 +315,13 @@ 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. diff --git a/src/reference/cli/forge/create.md b/src/reference/cli/forge/create.md index 3291df2d8..14b77ba0b 100644 --- a/src/reference/cli/forge/create.md +++ b/src/reference/cli/forge/create.md @@ -53,6 +53,13 @@ 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. diff --git a/src/reference/cli/forge/debug.md b/src/reference/cli/forge/debug.md index f439660e9..d62e76028 100644 --- a/src/reference/cli/forge/debug.md +++ b/src/reference/cli/forge/debug.md @@ -45,6 +45,13 @@ 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. diff --git a/src/reference/cli/forge/eip712.md b/src/reference/cli/forge/eip712.md index 9b14b1b5a..f8e06c016 100644 --- a/src/reference/cli/forge/eip712.md +++ b/src/reference/cli/forge/eip712.md @@ -25,6 +25,13 @@ 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. diff --git a/src/reference/cli/forge/inspect.md b/src/reference/cli/forge/inspect.md index d2d910430..1323dda0c 100644 --- a/src/reference/cli/forge/inspect.md +++ b/src/reference/cli/forge/inspect.md @@ -37,6 +37,13 @@ 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. diff --git a/src/reference/cli/forge/script.md b/src/reference/cli/forge/script.md index 17dc138c2..a6553f520 100644 --- a/src/reference/cli/forge/script.md +++ b/src/reference/cli/forge/script.md @@ -129,6 +129,13 @@ 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. diff --git a/src/reference/cli/forge/selectors/collision.md b/src/reference/cli/forge/selectors/collision.md index f2d4b6156..0fe0dd5fe 100644 --- a/src/reference/cli/forge/selectors/collision.md +++ b/src/reference/cli/forge/selectors/collision.md @@ -30,6 +30,13 @@ 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. diff --git a/src/reference/cli/forge/snapshot.md b/src/reference/cli/forge/snapshot.md index 6bbb1a040..2658fd8bf 100644 --- a/src/reference/cli/forge/snapshot.md +++ b/src/reference/cli/forge/snapshot.md @@ -313,6 +313,13 @@ 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. diff --git a/src/reference/cli/forge/test.md b/src/reference/cli/forge/test.md index faabfdb5c..fa5430c99 100644 --- a/src/reference/cli/forge/test.md +++ b/src/reference/cli/forge/test.md @@ -292,6 +292,13 @@ 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. From 37a9b02ed5770016f285cb5865f50a2702bb36fd Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Wed, 9 Oct 2024 18:48:26 +0200 Subject: [PATCH 12/15] Revert "Update installation.md" (#1328) Revert "Update installation.md (#1313)" This reverts commit ce804d1d2472cd151d03a58c7c646764f1940260. --- src/getting-started/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/getting-started/installation.md b/src/getting-started/installation.md index 749925414..cbe71d3ca 100644 --- a/src/getting-started/installation.md +++ b/src/getting-started/installation.md @@ -49,7 +49,7 @@ foundryup --path path/to/foundry Alternatively, you can install via Cargo with the following command: ```sh -cargo install --git https://github.com/foundry-rs/foundry --profile release --locked forge foundry-cast chisel anvil +cargo install --git https://github.com/foundry-rs/foundry --profile release --locked forge cast chisel anvil ``` You can also manually build from a local copy of the [Foundry repository](https://github.com/foundry-rs/foundry): From 786f59406992489e800050bc0be6d3d1a51afe0c Mon Sep 17 00:00:00 2001 From: Tomas C Imach <43709975+TomasCImach@users.noreply.github.com> Date: Fri, 11 Oct 2024 21:13:13 -0300 Subject: [PATCH 13/15] Fix: Remove Counter.s.sol to resolve forge build error (#1331) Remove Counter.s.sol script file --- src/tutorials/solidity-scripting.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tutorials/solidity-scripting.md b/src/tutorials/solidity-scripting.md index 659ea6b74..0d9d33abd 100644 --- a/src/tutorials/solidity-scripting.md +++ b/src/tutorials/solidity-scripting.md @@ -38,7 +38,7 @@ forge install transmissions11/solmate Openzeppelin/openzeppelin-contracts@v5.0.1 Next, we have to delete the `Counter.sol` file in the `src` folder and create another file called `NFT.sol`. You can do this by running: ```sh -rm src/Counter.sol test/Counter.t.sol && touch src/NFT.sol && ls src +rm src/Counter.sol test/Counter.t.sol script/Counter.s.sol && touch src/NFT.sol && ls src ``` ![set up commands](../images/solidity-scripting/set-up-commands.png) From d61aebd469f4298de6b24bbf02aa6d0fb0d1da64 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 13 Oct 2024 07:20:57 +0200 Subject: [PATCH 14/15] chore(output): weekly command output update (#1332) update command output Co-authored-by: mattsse --- src/SUMMARY.md | 1 + src/output/cast/cast-call | 2 +- src/output/cheatcodes/forge-test-cheatcodes | 4 +-- .../forge-test-cheatcodes-expectrevert | 4 +-- .../cheatcodes/forge-test-cheatcodes-tracing | 4 +-- src/output/cheatcodes/forge-test-simple | 6 ++--- src/output/deps/forge-install | 2 +- src/output/foundry-template/forge-build | 2 +- src/output/foundry-template/forge-test | 4 +-- src/output/fuzz_testing/forge-test-fail-fuzz | 8 +++--- src/output/fuzz_testing/forge-test-no-fuzz | 4 +-- .../fuzz_testing/forge-test-success-fuzz | 8 +++--- src/output/hello_foundry/forge-init | 4 +-- src/output/hello_foundry/forge-test | 6 ++--- src/output/nft_tutorial/forge-test | 26 +++++++++---------- .../forge-test-match-contract-and-test | 6 ++--- src/output/test_filters/forge-test-match-path | 4 +-- src/reference/cli/SUMMARY.md | 1 + src/reference/cli/anvil.md | 7 ++++- src/reference/cli/cast/storage.md | 4 ++- src/reference/cli/chisel.md | 5 +++- src/reference/cli/chisel/eval.md | 17 ++++++++++++ src/reference/cli/forge/bind-json.md | 4 ++- src/reference/cli/forge/bind.md | 4 ++- src/reference/cli/forge/build.md | 4 ++- src/reference/cli/forge/config.md | 4 ++- src/reference/cli/forge/coverage.md | 4 ++- src/reference/cli/forge/create.md | 4 ++- src/reference/cli/forge/debug.md | 4 ++- src/reference/cli/forge/eip712.md | 4 ++- src/reference/cli/forge/inspect.md | 4 ++- src/reference/cli/forge/script.md | 4 ++- .../cli/forge/selectors/collision.md | 4 ++- src/reference/cli/forge/snapshot.md | 4 ++- src/reference/cli/forge/soldeer.md | 4 +-- src/reference/cli/forge/soldeer/init.md | 2 +- src/reference/cli/forge/soldeer/install.md | 18 +++++++++---- src/reference/cli/forge/soldeer/login.md | 2 +- src/reference/cli/forge/soldeer/push.md | 6 ++--- src/reference/cli/forge/soldeer/update.md | 5 ++-- src/reference/cli/forge/test.md | 4 ++- 41 files changed, 141 insertions(+), 77 deletions(-) create mode 100644 src/reference/cli/chisel/eval.md diff --git a/src/SUMMARY.md b/src/SUMMARY.md index 336c90cfb..3ae225056 100644 --- a/src/SUMMARY.md +++ b/src/SUMMARY.md @@ -245,6 +245,7 @@ - [`chisel load`](./reference/cli/chisel/load.md) - [`chisel view`](./reference/cli/chisel/view.md) - [`chisel clear-cache`](./reference/cli/chisel/clear-cache.md) + - [`chisel eval`](./reference/cli/chisel/eval.md) - [`forge` Commands](./reference/forge/README.md) - [General Commands](./reference/forge/general-commands.md) - [forge](./reference/forge/forge.md) diff --git a/src/output/cast/cast-call b/src/output/cast/cast-call index 7368f359c..e14018918 100644 --- a/src/output/cast/cast-call +++ b/src/output/cast/cast-call @@ -3,6 +3,6 @@ $ cast call 0x6b175474e89094c44da98b954eedeac495271d0f "totalSupply()(uint256)" --rpc-url https://eth-mainnet.alchemyapi.io/v2/Lc7oIGYeL_QvInzI0Wiu_pOZZDEKBrdf // ANCHOR_END: command // ANCHOR: output -3109318878827982953647909191 [3.109e27] +3347058897504830755961921877 [3.347e27] // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes b/src/output/cheatcodes/forge-test-cheatcodes index e9bd50090..c6f1aec92 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes +++ b/src/output/cheatcodes/forge-test-cheatcodes @@ -8,8 +8,8 @@ No files changed, compilation skipped Ran 2 tests for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] testFail_IncrementAsNotOwner() (gas: 8314) [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 452.51µs (122.03µs CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 533.11µs (146.94µs CPU time) -Ran 1 test suite in 6.31ms (452.51µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.82ms (533.11µs CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert index e842035fb..42e57f558 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-expectrevert +++ b/src/output/cheatcodes/forge-test-cheatcodes-expectrevert @@ -7,8 +7,8 @@ No files changed, compilation skipped Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 372.89µs (51.00µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 397.98µs (79.50µs CPU time) -Ran 1 test suite in 5.55ms (372.89µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 6.09ms (397.98µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-cheatcodes-tracing b/src/output/cheatcodes/forge-test-cheatcodes-tracing index 8ecba2856..3bc67e46c 100644 --- a/src/output/cheatcodes/forge-test-cheatcodes-tracing +++ b/src/output/cheatcodes/forge-test-cheatcodes-tracing @@ -15,8 +15,8 @@ Traces: │ └─ ← [Revert] Unauthorized() └─ ← [Revert] Unauthorized() -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 401.29µs (61.48µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 426.90µs (81.38µs CPU time) -Ran 1 test suite in 5.77ms (401.29µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.93ms (426.90µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/cheatcodes/forge-test-simple b/src/output/cheatcodes/forge-test-simple index 83e8a50e0..94c680855 100644 --- a/src/output/cheatcodes/forge-test-simple +++ b/src/output/cheatcodes/forge-test-simple @@ -4,13 +4,13 @@ $ forge test --match-test test_IncrementAsOwner // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.14s +Solc 0.8.10 finished in 1.18s Compiler run successful! Ran 1 test for test/OwnerUpOnly.t.sol:OwnerUpOnlyTest [PASS] test_IncrementAsOwner() (gas: 29161) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 483.66µs (81.45µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 417.38µs (52.76µs CPU time) -Ran 1 test suite in 5.56ms (483.66µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.73ms (417.38µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/deps/forge-install b/src/output/deps/forge-install index edcfeb7e2..955aad1da 100644 --- a/src/output/deps/forge-install +++ b/src/output/deps/forge-install @@ -3,7 +3,7 @@ $ forge install transmissions11/solmate // ANCHOR_END: command // ANCHOR: output -Installing solmate in /tmp/tmp.75JYewHG5d/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) +Installing solmate in /tmp/tmp.VUb1IuoRVS/deps/lib/solmate (url: Some("https://github.com/transmissions11/solmate"), tag: None) Installed solmate // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-build b/src/output/foundry-template/forge-build index 546d405dd..5a6b51dd8 100644 --- a/src/output/foundry-template/forge-build +++ b/src/output/foundry-template/forge-build @@ -4,7 +4,7 @@ $ forge build // ANCHOR_END: command // ANCHOR: output Compiling 28 files with Solc 0.8.25 -Solc 0.8.25 finished in 1.35s +Solc 0.8.25 finished in 1.32s Compiler run successful! // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/foundry-template/forge-test b/src/output/foundry-template/forge-test index 309e012f5..54aa81328 100644 --- a/src/output/foundry-template/forge-test +++ b/src/output/foundry-template/forge-test @@ -9,8 +9,8 @@ Ran 3 tests for test/Foo.t.sol:FooTest [PASS] testFork_Example() (gas: 3779) [PASS] testFuzz_Example(uint256) (runs: 1000, μ: 9111, ~: 9111) [PASS] test_Example() (gas: 11861) -Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 19.97ms (19.77ms CPU time) +Suite result: ok. 3 passed; 0 failed; 0 skipped; finished in 19.86ms (19.69ms CPU time) -Ran 1 test suite in 20.94ms (19.97ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) +Ran 1 test suite in 20.99ms (19.86ms CPU time): 3 tests passed, 0 failed, 0 skipped (3 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-fail-fuzz b/src/output/fuzz_testing/forge-test-fail-fuzz index 26b123f67..1ad5412c2 100644 --- a/src/output/fuzz_testing/forge-test-fail-fuzz +++ b/src/output/fuzz_testing/forge-test-fail-fuzz @@ -4,13 +4,13 @@ $ forge test --allow-failure // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.08s +Solc 0.8.10 finished in 1.06s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[FAIL: EvmError: Revert; counterexample: calldata=0x29facca7000000000000000001d8dbee6aa2fb9b6fd5be77d33b906c7c8636a2197258e5 args=[45290904529516386323350766163740848821611920638889580773 [4.529e55]]] testFuzz_Withdraw(uint256) (runs: 1, μ: 19531, ~: 19531) -Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 822.82µs (476.78µs CPU time) +[FAIL: EvmError: Revert; counterexample: calldata=0x29facca7000000000000000003556da6102a3b7afaa8feb8a1a2374fda2930b257d0c8cc args=[81742192965658243310166281265431943153681750921120368844 [8.174e55]]] testFuzz_Withdraw(uint256) (runs: 1, μ: 19531, ~: 19531) +Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 794.99µs (479.30µs CPU time) -Ran 1 test suite in 6.70ms (822.82µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) +Ran 1 test suite in 6.13ms (794.99µs CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-no-fuzz b/src/output/fuzz_testing/forge-test-no-fuzz index 052f29ceb..1d25a806d 100644 --- a/src/output/fuzz_testing/forge-test-no-fuzz +++ b/src/output/fuzz_testing/forge-test-no-fuzz @@ -9,8 +9,8 @@ Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest [PASS] test_Withdraw() (gas: 19463) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 404.34µs (52.05µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 414.39µs (50.35µs CPU time) -Ran 1 test suite in 5.44ms (404.34µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 6.00ms (414.39µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/fuzz_testing/forge-test-success-fuzz b/src/output/fuzz_testing/forge-test-success-fuzz index 38550ac6a..1e59a9363 100644 --- a/src/output/fuzz_testing/forge-test-success-fuzz +++ b/src/output/fuzz_testing/forge-test-success-fuzz @@ -4,13 +4,13 @@ $ forge test // ANCHOR_END: command // ANCHOR: output Compiling 1 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.08s +Solc 0.8.10 finished in 1.05s Compiler run successful! Ran 1 test for test/Safe.t.sol:SafeTest -[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19318, ~: 19631) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.95ms (4.59ms CPU time) +[PASS] testFuzz_Withdraw(uint96) (runs: 257, μ: 19213, ~: 19631) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 4.96ms (4.55ms CPU time) -Ran 1 test suite in 5.85ms (4.95ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 6.12ms (4.96ms CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/hello_foundry/forge-init b/src/output/hello_foundry/forge-init index bc98d2b58..4eecf5a92 100644 --- a/src/output/hello_foundry/forge-init +++ b/src/output/hello_foundry/forge-init @@ -3,8 +3,8 @@ $ forge init hello_foundry // ANCHOR_END: command // ANCHOR: output -Initializing /tmp/tmp.ZzvYQlcflC/hello_foundry... -Installing forge-std in /tmp/tmp.ZzvYQlcflC/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) +Initializing /tmp/tmp.plKOHNkfMc/hello_foundry... +Installing forge-std in /tmp/tmp.plKOHNkfMc/hello_foundry/lib/forge-std (url: Some("https://github.com/foundry-rs/forge-std"), tag: None) Installed forge-std v1.9.3 Initialized forge project // ANCHOR_END: output diff --git a/src/output/hello_foundry/forge-test b/src/output/hello_foundry/forge-test index 60559ae08..8d3e01271 100644 --- a/src/output/hello_foundry/forge-test +++ b/src/output/hello_foundry/forge-test @@ -6,10 +6,10 @@ $ forge test No files changed, compilation skipped Ran 2 tests for test/Counter.t.sol:CounterTest -[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 31210, ~: 31288) +[PASS] testFuzz_SetNumber(uint256) (runs: 256, μ: 31288, ~: 31288) [PASS] test_Increment() (gas: 31303) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.48ms (8.17ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 8.75ms (8.36ms CPU time) -Ran 1 test suite in 9.35ms (8.48ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 9.79ms (8.75ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/nft_tutorial/forge-test b/src/output/nft_tutorial/forge-test index fadd636c5..83cc22dfd 100644 --- a/src/output/nft_tutorial/forge-test +++ b/src/output/nft_tutorial/forge-test @@ -5,17 +5,6 @@ $ forge test // ANCHOR: output No files changed, compilation skipped -Ran 8 tests for test/SolmateNft.sol:SolmateNftTests -[PASS] testBalanceIncremented() (gas: 217400) -[PASS] testFailMaxSupplyReached() (gas: 134524) -[PASS] testFailMintToZeroAddress() (gas: 34521) -[PASS] testFailNoMintPricePaid() (gas: 5568) -[PASS] testFailUnSafeContractReceiver() (gas: 3524) -[PASS] testMintPricePaid() (gas: 81321) -[PASS] testNewMintOwnerRegistered() (gas: 190741) -[PASS] testSafeContractReceiver() (gas: 272636) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.71ms (1.32ms CPU time) - Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests [PASS] testBalanceIncremented() (gas: 217829) [PASS] testFailMaxSupplyReached() (gas: 134524) @@ -25,8 +14,19 @@ Ran 8 tests for test/OpenZeppelinNft.t.sol:OpenZeppelinNftTests [PASS] testMintPricePaid() (gas: 81554) [PASS] testNewMintOwnerRegistered() (gas: 190956) [PASS] testSafeContractReceiver() (gas: 273132) -Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.72ms (2.07ms CPU time) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.63ms (1.23ms CPU time) + +Ran 8 tests for test/SolmateNft.sol:SolmateNftTests +[PASS] testBalanceIncremented() (gas: 217400) +[PASS] testFailMaxSupplyReached() (gas: 134524) +[PASS] testFailMintToZeroAddress() (gas: 34521) +[PASS] testFailNoMintPricePaid() (gas: 5568) +[PASS] testFailUnSafeContractReceiver() (gas: 3524) +[PASS] testMintPricePaid() (gas: 81321) +[PASS] testNewMintOwnerRegistered() (gas: 190741) +[PASS] testSafeContractReceiver() (gas: 272636) +Suite result: ok. 8 passed; 0 failed; 0 skipped; finished in 1.63ms (1.36ms CPU time) -Ran 2 test suites in 5.75ms (3.44ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) +Ran 2 test suites in 6.20ms (3.25ms CPU time): 16 tests passed, 0 failed, 0 skipped (16 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-contract-and-test b/src/output/test_filters/forge-test-match-contract-and-test index a60920fbf..15648fba2 100644 --- a/src/output/test_filters/forge-test-match-contract-and-test +++ b/src/output/test_filters/forge-test-match-contract-and-test @@ -4,14 +4,14 @@ $ forge test --match-contract ComplicatedContractTest --match-test test_Deposit // ANCHOR_END: command // ANCHOR: output Compiling 24 files with Solc 0.8.10 -Solc 0.8.10 finished in 1.12s +Solc 0.8.10 finished in 1.09s Compiler run successful! Ran 2 tests for test/ComplicatedContract.t.sol:ComplicatedContractTest [PASS] test_DepositERC20() (gas: 102193) [PASS] test_DepositETH() (gas: 61414) -Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.34ms (1.43ms CPU time) +Suite result: ok. 2 passed; 0 failed; 0 skipped; finished in 1.15ms (1.40ms CPU time) -Ran 1 test suite in 5.73ms (1.34ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) +Ran 1 test suite in 5.96ms (1.15ms CPU time): 2 tests passed, 0 failed, 0 skipped (2 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/output/test_filters/forge-test-match-path b/src/output/test_filters/forge-test-match-path index 41bbfaea4..5726e2010 100644 --- a/src/output/test_filters/forge-test-match-path +++ b/src/output/test_filters/forge-test-match-path @@ -9,8 +9,8 @@ Compiler run successful! Ran 1 test for test/ContractB.t.sol:ContractBTest [PASS] testExample() (gas: 257) -Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 310.04µs (56.68µs CPU time) +Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 330.42µs (45.00µs CPU time) -Ran 1 test suite in 5.38ms (310.04µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) +Ran 1 test suite in 5.72ms (330.42µs CPU time): 1 tests passed, 0 failed, 0 skipped (1 total tests) // ANCHOR_END: output // ANCHOR_END: all diff --git a/src/reference/cli/SUMMARY.md b/src/reference/cli/SUMMARY.md index e66031b0a..370e7ea78 100644 --- a/src/reference/cli/SUMMARY.md +++ b/src/reference/cli/SUMMARY.md @@ -160,4 +160,5 @@ - [`chisel load`](./chisel/load.md) - [`chisel view`](./chisel/view.md) - [`chisel clear-cache`](./chisel/clear-cache.md) + - [`chisel eval`](./chisel/eval.md) diff --git a/src/reference/cli/anvil.md b/src/reference/cli/anvil.md index 86562bbc5..6a19d29bc 100644 --- a/src/reference/cli/anvil.md +++ b/src/reference/cli/anvil.md @@ -268,6 +268,11 @@ Environment config: --disable-code-size-limit Disable EIP-170: Contract code size limit + --disable-min-priority-fee + Disable the enforcement of a minimum suggested priority fee + + [aliases: no-priority-fee] + --gas-limit The block gas limit @@ -278,7 +283,7 @@ EVM options: --alphanet Enable Alphanet features - [aliases: alphanet] + [aliases: odyssey] --auto-impersonate Enable autoImpersonate on startup diff --git a/src/reference/cli/cast/storage.md b/src/reference/cli/cast/storage.md index 92e1af80b..da747a207 100644 --- a/src/reference/cli/cast/storage.md +++ b/src/reference/cli/cast/storage.md @@ -128,8 +128,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/chisel.md b/src/reference/cli/chisel.md index 776503ae0..e8b5c8b10 100644 --- a/src/reference/cli/chisel.md +++ b/src/reference/cli/chisel.md @@ -14,6 +14,7 @@ Commands: load Load a cached session view View the source of a cached session clear-cache Clear all cached chisel sessions from the cache directory + eval Simple evaluation of a command without entering the REPL help Print this message or the help of the given subcommand(s) Options: @@ -102,8 +103,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/chisel/eval.md b/src/reference/cli/chisel/eval.md new file mode 100644 index 000000000..e05ef23f6 --- /dev/null +++ b/src/reference/cli/chisel/eval.md @@ -0,0 +1,17 @@ +# chisel eval + +Simple evaluation of a command without entering the REPL + +```bash +$ chisel eval --help +``` + +```txt +Usage: chisel eval + +Arguments: + The command to be evaluated + +Options: + -h, --help Print help +``` \ No newline at end of file diff --git a/src/reference/cli/forge/bind-json.md b/src/reference/cli/forge/bind-json.md index 4261b09d3..2d01bc2f6 100644 --- a/src/reference/cli/forge/bind-json.md +++ b/src/reference/cli/forge/bind-json.md @@ -82,8 +82,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/bind.md b/src/reference/cli/forge/bind.md index f1ab0503f..086226f0c 100644 --- a/src/reference/cli/forge/bind.md +++ b/src/reference/cli/forge/bind.md @@ -138,8 +138,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/build.md b/src/reference/cli/forge/build.md index 74f10ac07..cca085a2e 100644 --- a/src/reference/cli/forge/build.md +++ b/src/reference/cli/forge/build.md @@ -87,8 +87,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/config.md b/src/reference/cli/forge/config.md index 3b48ac486..35a4de85d 100644 --- a/src/reference/cli/forge/config.md +++ b/src/reference/cli/forge/config.md @@ -96,8 +96,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/coverage.md b/src/reference/cli/forge/coverage.md index 4c31c8750..45c47f4f1 100644 --- a/src/reference/cli/forge/coverage.md +++ b/src/reference/cli/forge/coverage.md @@ -372,8 +372,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/create.md b/src/reference/cli/forge/create.md index 14b77ba0b..0724f84f0 100644 --- a/src/reference/cli/forge/create.md +++ b/src/reference/cli/forge/create.md @@ -110,8 +110,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/debug.md b/src/reference/cli/forge/debug.md index d62e76028..53641f9fb 100644 --- a/src/reference/cli/forge/debug.md +++ b/src/reference/cli/forge/debug.md @@ -102,8 +102,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/eip712.md b/src/reference/cli/forge/eip712.md index f8e06c016..5db0d62ba 100644 --- a/src/reference/cli/forge/eip712.md +++ b/src/reference/cli/forge/eip712.md @@ -82,8 +82,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/inspect.md b/src/reference/cli/forge/inspect.md index 1323dda0c..599226197 100644 --- a/src/reference/cli/forge/inspect.md +++ b/src/reference/cli/forge/inspect.md @@ -94,8 +94,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/script.md b/src/reference/cli/forge/script.md index a6553f520..c62c0e7a0 100644 --- a/src/reference/cli/forge/script.md +++ b/src/reference/cli/forge/script.md @@ -186,8 +186,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/selectors/collision.md b/src/reference/cli/forge/selectors/collision.md index 0fe0dd5fe..517cdff07 100644 --- a/src/reference/cli/forge/selectors/collision.md +++ b/src/reference/cli/forge/selectors/collision.md @@ -87,8 +87,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/snapshot.md b/src/reference/cli/forge/snapshot.md index 2658fd8bf..8af3aebed 100644 --- a/src/reference/cli/forge/snapshot.md +++ b/src/reference/cli/forge/snapshot.md @@ -370,8 +370,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the diff --git a/src/reference/cli/forge/soldeer.md b/src/reference/cli/forge/soldeer.md index 52009f775..1ae9ccbeb 100644 --- a/src/reference/cli/forge/soldeer.md +++ b/src/reference/cli/forge/soldeer.md @@ -10,10 +10,10 @@ $ forge soldeer --help Usage: Native Solidity Package Manager, `run forge soldeer [COMMAND] --help` for more details Commands: - init Initialize a new Soldeer project for use with Foundry + init Convert a Foundry project to use Soldeer install Install a dependency update Update dependencies by reading the config file - login Log into the central repository to push the dependencies + login Log into the central repository to push packages push Push a dependency to the repository uninstall Uninstall a dependency version Display the version of Soldeer diff --git a/src/reference/cli/forge/soldeer/init.md b/src/reference/cli/forge/soldeer/init.md index c66fd3e95..418a9b201 100644 --- a/src/reference/cli/forge/soldeer/init.md +++ b/src/reference/cli/forge/soldeer/init.md @@ -1,6 +1,6 @@ # forge soldeer init -Initialize a new Soldeer project for use with Foundry +Convert a Foundry project to use Soldeer ```bash $ forge soldeer init --help diff --git a/src/reference/cli/forge/soldeer/install.md b/src/reference/cli/forge/soldeer/install.md index 7090a63ec..c287dbd3d 100644 --- a/src/reference/cli/forge/soldeer/install.md +++ b/src/reference/cli/forge/soldeer/install.md @@ -11,18 +11,23 @@ Usage: forge soldeer install [OPTIONS] [DEPENDENCY~VERSION] [URL] Arguments: [DEPENDENCY~VERSION] - The dependency name and version, separated by a tilde. + The dependency name and version, separated by a tilde. The version is + always required. - If not present, this command will perform `soldeer update` + If not present, this command will install all dependencies which are + missing. [URL] - The URL to the dependency zip file, if not from the Soldeer repository + The URL to the dependency zip file. + + If not present, the package will be installed from the Soldeer + repository. Example: https://my-domain/dep.zip Options: --rev - A Git revision + A Git commit hash --tag A Git tag @@ -35,9 +40,12 @@ Options: them -d, --recursive-deps - If set, this command will install the recursive dependencies (via + If set, this command will install dependencies recursively (via git submodules or via soldeer) + --clean + Perform a clean install by re-installing all dependencies + -h, --help Print help (see a summary with '-h') diff --git a/src/reference/cli/forge/soldeer/login.md b/src/reference/cli/forge/soldeer/login.md index b9236d171..88573b2a2 100644 --- a/src/reference/cli/forge/soldeer/login.md +++ b/src/reference/cli/forge/soldeer/login.md @@ -1,6 +1,6 @@ # forge soldeer login -Log into the central repository to push the dependencies +Log into the central repository to push packages ```bash $ forge soldeer login --help diff --git a/src/reference/cli/forge/soldeer/push.md b/src/reference/cli/forge/soldeer/push.md index ff3ff8235..a3f25e106 100644 --- a/src/reference/cli/forge/soldeer/push.md +++ b/src/reference/cli/forge/soldeer/push.md @@ -17,15 +17,15 @@ Arguments: central repository: ``. [PATH] - Use this if the dependency you want to push is not in the current + Use this if the package you want to push is not in the current directory. Example: `soldeer push mypkg~0.1.0 /path/to/dep`. Options: -d, --dry-run - Use this if you want to run a dry run. If set, this will generate a - zip file that you can inspect to see what will be pushed + If set, does not publish the package but generates a zip file that can + be inspected --skip-warnings Use this if you want to skip the warnings that can be triggered when diff --git a/src/reference/cli/forge/soldeer/update.md b/src/reference/cli/forge/soldeer/update.md index 676daef49..f07e1bb27 100644 --- a/src/reference/cli/forge/soldeer/update.md +++ b/src/reference/cli/forge/soldeer/update.md @@ -12,8 +12,9 @@ Usage: forge soldeer update [OPTIONS] Options: -g, --regenerate-remappings If set, this command will delete the existing remappings and re-create them - -d, --recursive-deps If set, this command will install the recursive - dependencies (via submodules or via soldeer) + -d, --recursive-deps If set, this command will install the + dependencies recursively (via submodules or via + soldeer) -h, --help Print help For more information, read the README.md diff --git a/src/reference/cli/forge/test.md b/src/reference/cli/forge/test.md index fa5430c99..f25b609b9 100644 --- a/src/reference/cli/forge/test.md +++ b/src/reference/cli/forge/test.md @@ -349,8 +349,10 @@ Compiler options: --evm-version The target EVM version - --optimize + --optimize [] Activate the Solidity optimizer + + [possible values: true, false] --optimizer-runs The number of runs specifies roughly how often each opcode of the From c1fe66deb639f82010d0b91cd528eeea1314eb2d Mon Sep 17 00:00:00 2001 From: grandizzy <38490174+grandizzy@users.noreply.github.com> Date: Mon, 14 Oct 2024 20:58:51 +0300 Subject: [PATCH 15/15] Update test match configs (#1333) --- src/static/config.default.toml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/static/config.default.toml b/src/static/config.default.toml index 1bcf419fc..fd6021156 100644 --- a/src/static/config.default.toml +++ b/src/static/config.default.toml @@ -115,17 +115,19 @@ rpc_endpoints = { optimism = "https://optimism.alchemyapi.io/v2/...", mainnet = # Etherscan API key #etherscan_api_key = None # Only run test functions matching the specified regex pattern -#test_pattern = None +#match_test = None # Only run test functions that do not match the specified regex pattern -#test_pattern_inverse = None +#no_match_test = None # Only run tests in contracts matching the specified regex pattern -#contract_pattern = None +#match_contract = None # Only run tests in contracts that do not match the specified regex pattern -#contract_pattern_inverse = None +#no_match_contract = None # Only run tests in source files matching the specified glob pattern -#path_pattern = None +#match_path = None # Only run tests in source files that do not match the specified glob pattern -#path_pattern_inverse = None +#no_match_path = None +# Only show coverage for files that do not match the specified regex pattern. +#no_match_coverage = None # Number of threads to use. Not set or zero specifies the number of logical cores. #threads = 0 # Whether to show test execution progress