foundry-rs / foundry-rs/foundry
feat(`forge test`): emit more details on log emittance
- Dominant language
- Rust
- Stars
- 10.6k
- Forks
- 2.6k
- Avg merge
- 16h 38m
- Merged PRs (30d)
- 511
Description
### Component
Forge
### Describe the feature you would like
This is printed when executing `forge test -vvvv`:
```
├─ emit Transfer(from: Transfer_Test: [0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496], to: Bob: [0x4dBa461cA9342F4A6Cf942aBd7eacf8AE259108C], value: 100)
```
It is unclear what went into topics, what into data.
It would also be useful to add logIndex to identify subsequent logs.
Log example from `cast logs`
```
transactionHash: 0x11f22560ab96e501cf27f6d1b8645629dba0fc5acea9667241033a69eccf9691
transactionIndex: 62
- address: 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
blockHash: 0x44bc4afafaba68dbedbba3c4c2ec253a27b4b2fc7b9493374743003a55f71380
blockNumber: 20867999
data: 0x0000000000000000000000000000000000000000000000000008d2ed25b1b776
logIndex: 357
removed: false
topics: [
0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
0x0000000000000000000000003fc91a3afd70395cd496c647d5a6cc9d4b2b7fad
0x000000000000000000000000000000fee13a103a10d593b9ae06b3e05f2e7e1c
]
```
I do not propose to extend the amount of rows, rather the indication, e.g.:
```
├─ emit #2 Transfer(t1: from: Transfer_Test: [0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496], t2: to: Bob: [0x4dBa461cA9342F4A6Cf942aBd7eacf8AE259108C], d: value: 100); t0: 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef
```
where # is a logIndex, d: means data, t0 topic 0, t1 topic 1, ...
### Additional context
_No response_
Contributor guide
Research direction
Start at the `forge test -vvvv` event-emission output path and compare its formatting with the `cast logs` fields shown in the issue. Verify the finished output identifies the log index and distinguishes data from each topic without adding rows.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, testing, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100