argotorg / argotorg/solidity

Events missing in library ABI when using another lib

Open
#15,752 0 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
21

Description

## Description

After reading https://github.com/ethereum/solidity/issues/14501, I believe the case I am describing is not well-expected behavior.

When including a library `Lib` (with `using-for`) into another library `Lib2`, events from `Lib` are missing in `Lib2` ABI. However, when I do the same with a contract, i.e. include `Lib` into contract `Foo`, the contract's ABI includes events from `Lib`.

Note that `Lib2` may be deployed as a standalone lib and delegatecalled into, making it impossible to resolve the emitted event correctly.

![Image](https://github.com/user-attachments/assets/733d58ed-7060-4381-b9c8-5dbd8e9304b5)

## Environment

- Compiler version: 0.8.28, 0.8.0, 0.7.0
- Compilation pipeline (legacy, IR, EOF): legacy, IR
- Target EVM version (as per compiler settings):
- Framework/IDE (e.g. Foundry, Hardhat, Remix):
- EVM execution environment / backend / blockchain client:
- Operating system: macOS

## Steps to Reproduce

Compile and print ABI

```solidity
library Lib {
event Foo(uint256 value);

function foo(uint256 value) internal {
emit Foo(value);
}
}

library Lib2 {
using Lib for uint256;

function foo2(uint256 value) internal {
value.foo();
}
}

contract Foo {
using Lib for uint256;

function bar() public {
uint256 value = 1;
value.foo();
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start with the Solidity reproduction and compile it through the legacy and IR pipelines described in the issue, comparing the ABIs for Lib2 and Foo. Trace the compiler's ABI handling for library events and add coverage showing that the expected event information is present when Lib2 is compiled; done means the reproduction produces the intended ABI.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.