Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend library refs processing, fix in error messages for setUp #861

Merged
merged 7 commits into from
Oct 11, 2024

Conversation

palinatolmach
Copy link
Collaborator

@palinatolmach palinatolmach commented Oct 10, 2024

Follow up to #838.

This PR fixes the following lib-related issues manifesting in the test included in the PR:

library LibrarySum {
    function sum(uint256 a, uint256 b) external pure returns (uint256 res) {
        res = a + b;
    }
}

library LibraryEq {
    function eq(uint256 a, uint256 b, uint256 c) internal returns (bool res) {
       uint256 sum = LibrarySum.sum(a, b);
       return (sum == c);
    }
}

contract ExternalNestedLibraryTest is Test {
    uint256 public z = 10;

    function testExtLibs() public {
        uint256 x = 3;
        uint256 y = 7;
        bool res = LibraryEq.eq(x, y, z);
        assert(res);
    }
}
  • The first issue is missing support for dynamically linked libraries that rely on other dynamically linked libraries;
  • The other is replacing library refs in bytecode (not deployed_bytecode) in case the proof is ran with --run-constructor
  • Adds ExternalNestedLibraryTest to the test suite and test_foundry_init_code specifically
  • It also makes a small update to the way the error message is printed if init or setUp are failing — the contract name is now pretty-printed

@palinatolmach palinatolmach marked this pull request as ready for review October 10, 2024 14:23
@palinatolmach palinatolmach merged commit 05934f6 into master Oct 11, 2024
12 checks passed
@palinatolmach palinatolmach deleted the init-bytecode-lib-refs branch October 11, 2024 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants