foundry icon indicating copy to clipboard operation
foundry copied to clipboard

feat(forge): add labels for precompile addresses

Open grandizzy opened this issue 10 months ago • 1 comments

Motivation

Closes #7530

Not all precompiles are labeled, this PR add missing labels

Solution

  • added precompile addresses in constants
  • in precompile decode match on address
  • add trace labels to all precompile addresses

grandizzy avatar Apr 02 '24 12:04 grandizzy

Precompile calls should already be labeled with PRECOMPILES::name(...) already. I don't really know about this.

That's right, thing is that labels for precompiles are not displayed along all traces but only when precompile is decoded, so for example in #7530 for following test setup

        address target = address(1);
        batchInbox.deposit{value: 1 ether}(target);
        assertEq(batchInbox.balances(target), 1 ether);

traces are shown as

    ├─ [22647] BatchInbox::deposit{value: 1000000000000000000}(0x0000000000000000000000000000000000000001)
    │   └─ ← [Stop] 
    ├─ [519] BatchInbox::balances(0x0000000000000000000000000000000000000001) [staticcall]
    │   └─ ← [Return] 1000000000000000000 [1e18]

as with current PR the ECRecover label is attached making clear that's a precompile:

    ├─ [22647] BatchInbox::deposit{value: 1000000000000000000}(ECRecover: [0x0000000000000000000000000000000000000001])
    │   └─ ← [Stop] 
    ├─ [519] BatchInbox::balances(ECRecover: [0x0000000000000000000000000000000000000001]) [staticcall]
    │   └─ ← [Return] 1000000000000000000 [1e18]

IMO would be a nice addition but nothing critical so we could drop this one if you think it doesn't worth @DaniPopes

grandizzy avatar Apr 09 '24 06:04 grandizzy

closing in favour of #8367

grandizzy avatar Jul 05 '24 10:07 grandizzy