-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Compiling a solidity library file with enum fails #349
Copy link
Copy link
Closed
Labels
C-forgeCommand: forgeCommand: forgeCmd-forge-buildCommand: forge buildCommand: forge buildP-highPriority: highPriority: highT-bugType: bugType: bug
Description
What happened?
Compilation failed (error below) when compiling a solidity file with imported enum as function parameters (enum declared in a separate library file)
EDIT: Compilation failed (error below) when compiling a solidity library file with enum as function parameter or return values.
forge build --root ~/git/project/eth --remappings @opengsn/=lib/gsn/packages/ @openzeppelin/=lib/openzeppelin-contracts/ --force
compiling...
Error:
0: InvalidName("LibTypes.CreatureSpecies") at line 1 column 3857567
Location:
cli/src/cmd/build.rs:96
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⋮ 4 frames hidden ⋮
5: forge::main::hd27355d3833fe780
at <unknown source file>:<unknown line>
6: std::sys_common::backtrace::__rust_begin_short_backtrace::hcb887eac5a464574
at <unknown source file>:<unknown line>
7: _main<unknown>
at <unknown source file>:<unknown line>
Isolated Failing Code
Enum in function param
pragma solidity ^0.7.6;
library LibTest {
enum TestEnum {
A,
B,
C
}
function foobar(TestEnum test) public view {}
}
Enum in function return
pragma solidity ^0.7.6;
library LibTest {
enum TestEnum {
A,
B,
C
}
function foobar() public view returns (TestEnum test) {}
}
NOTE: Both of these works fine if it is a contract instead of library
Possible explanation
Might be caused by ethabi? There's a "similar" issue although for a different case: rust-ethereum/ethabi#75
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-forgeCommand: forgeCommand: forgeCmd-forge-buildCommand: forge buildCommand: forge buildP-highPriority: highPriority: highT-bugType: bugType: bug