dapphub/dapp

test-hevm fails but test-ethrun pass with contract calling library

Closed this issue · 0 comments

With the following simple test code:

//WithLib.sol
pragma solidity ^0.4.21;

library MyLib {

	function libFunc(string s) public pure returns(uint) {
		return uint(keccak256(s));
	}
}

contract WithLib {
	
	function myFunc(string s) public pure returns(uint) {
		return MyLib.libFunc(s);
	}
}

And

//WithLib.t.sol
pragma solidity ^0.4.21;

import "ds-test/test.sol";

import "./WithLib.sol";

contract WithLibTest is DSTest {
    WithLib lib;

    function setUp() public {
        lib = new WithLib();
    }

    function test_myFunc() {
	lib.myFunc('a1');
    }
}

dapp test-ethrun passes but dapp test-hevm fails with out of gas (at the place when it calls the library)

Failure: test_myFunc
  
  src/WithLib.t.sol:WithLibTest
   ├╴constructor
   ├╴initialize test
   │  └╴create WithLib (src/WithLib.t.sol:11)
   └╴test_myFunc()
      ├╴call WithLib::myFunc(string)("a1") (src/WithLib.t.sol:15)
      │  └╴error OutOfGas 0xfbffffffefbd 0xfbfffffff279 (src/WithLib.sol:13)
      └╴error Revert (src/WithLib.t.sol:15)