You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As previously described in foundry-rs/foundry#4034, the latest version of forge (that now depends on compilers instead of ethers-rs) still doesn't properly handle situations when multiple files contain interfaces with the same name.
Example
Given two files FileA.sol and FileB.sol
// FileA.solpragma solidity^0.8.10;
import"./FileB.sol";
interfaceFooBar {
function foo() external;
}
contractA {
function execute() external {
FooBar(address(0)).foo();
}
}
// FileB.solpragma solidity^0.8.10;
interfaceFooBar {
function bar() external;
}
contractB {
function execute() external {
FooBar(address(0)).bar();
}
}
Flattening will currently produce:
pragma solidity^0.8.10;
interfaceFooBar {
function bar() external;
}
contractB {
function execute() external {
FooBar(address(0)).bar();
}
}
interfaceFooBar { // here is the conflict with the interface declared abovefunction foo() external;
}
contractA {
function execute() external {
FooBar(address(0)).foo();
}
}
Instead, the desired outcome is:
pragma solidity^0.8.10;
interfaceFooBar_2 {
function bar() external;
}
contractB {
function execute() external {
FooBar_2(address(0)).bar();
}
}
interfaceFooBar_1 { // conflict avoided since the interface above was renamed before flatteningfunction foo() external;
}
contractA {
function execute() external {
FooBar_1(address(0)).foo();
}
}
Notes
Although it's obviously discussable, we specifically propose to use incremental _N suffix for all interfaces in order to keep flattening backward compatible with hevm flatten command output. It is also more readable and independent from the project structure compared to the potential path-based prefix
The text was updated successfully, but these errors were encountered:
This issue is the successor of gakonst/ethers-rs#2588, created after the deprecation announcement of ethers-rs.
Other issues relevant to flattening are collected here: foundry-rs/foundry#6022.
Problem
As previously described in foundry-rs/foundry#4034, the latest version of forge (that now depends on
compilers
instead ofethers-rs
) still doesn't properly handle situations when multiple files contain interfaces with the same name.Example
Given two files
FileA.sol
andFileB.sol
Flattening will currently produce:
Instead, the desired outcome is:
Notes
_N
suffix for all interfaces in order to keep flattening backward compatible withhevm flatten
command output. It is also more readable and independent from the project structure compared to the potential path-based prefixThe text was updated successfully, but these errors were encountered: