-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Labels
T-featureType: featureType: featureT-needs-triageType: this issue needs to be labelledType: this issue needs to be labelled
Description
Component
Forge
Describe the feature you would like
When I find myself running failing tests with traces (-vvv), I very often would like to set a depth limit to the traces I get. Especially when I am fork-testing and I only want to debug the part that goes up to one level after external calls made by my contracts.
The idea is to turn a trace like
$ forge test -vvv
[FAIL: SomethingAintRight()] test_MyTest() (gas: 6666666)
Traces:
[6666666] MyContractForkTest::test_MyTest()
├─ [25350] MyContract::myMethod(true, 123))
│ ├─ emit Event()
│ └─ ← [Return] true
│ ├─ [90993] MyOtherContract::someMethod(456, false)
│ │ ├─ [75592] SomeDeployedContractInMyForkTest::itsOwnMethod() [staticcall]
│ │ │ ├─ [60284] TheImplementationOfThatContract::itsOwnMethod() [delegatecall]
│ │ │ │ ├─ [2603] SomeOtherDeployedContract::blablabla() [staticcall]
│ │ │ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000001
│ │ │ │ ├─ [2681] AndYetAnotherDeployedContract::youGetTheGist() [staticcall]
│ │ │ │ │ └─ ← [Return] 0x0000000000000000000000000000000000000000000000000000000000000002
│ │ │ │ └─ ← [Return] 1, 2
│ │ │ └─ ← [Return] false
│ | └─ ← [Revert] SomethingAintRight()
| └─ ← [Revert] SomethingAintRight()
└─ ← [Revert] Transfer failed
Into:
$ forge test -vvv -d 3 # or --depth 3
[FAIL: SomethingAintRight()] test_MyTest() (gas: 6666666)
Traces:
[6666666] MyContractForkTest::test_MyTest()
├─ [25350] MyContract::myMethod(true, 123))
│ ├─ emit Event()
│ └─ ← [Return] true
│ ├─ [90993] MyOtherContract::someMethod(456, false)
│ │ ├─ [75592] SomeDeployedContractInMyForkTest::itsOwnMethod() [staticcall]
│ │ │ └─ ← [Return] false
│ | └─ ← [Revert] SomethingAintRight()
| └─ ← [Revert] SomethingAintRight()
└─ ← [Revert] Transfer failed
Now obviously, this example is small but I think it illustrate the point. Otherwise, happy to show a real life example if that helps.
Additional context
I put the component forge in the dropdown but it would also apply for cast run
Metadata
Metadata
Assignees
Labels
T-featureType: featureType: featureT-needs-triageType: this issue needs to be labelledType: this issue needs to be labelled
Type
Projects
Status
Backlog