Giter Club home page Giter Club logo

Comments (5)

cmditch avatar cmditch commented on September 7, 2024 1

Alright, back in action. Did a full reinstall of dapp/solc/nix. Proxy tests are working now.

Experiencing some lockups with hevm, seems to be in instances where the call stack depth gets quite large - but this is probably a whole other issue - refactoring code has helped so far.

Thanks!

from dapptools.

rainbreak avatar rainbreak commented on September 7, 2024

This proxy does the delegatecall passing not(0) as the gas available, which is the whole wordsize and seems like a hack. If you replace that with sub(gas, 703) the test will pass, as this is the actual gas available minus the delegatecall overhead.

I'm not sure what the defined behaviour is here without looking at the yellow paper. Does it work with geth / parity?

from dapptools.

cmditch avatar cmditch commented on September 7, 2024

Thanks for the quick response @rainbreak! Good find on the assembly code. I'll paste a few reference links below regarding the origination of this contract code.

I've updated the code with your suggested change. The OutOfGas error is no more, but erroneous behavior still occurs.

Here is a gist to try with dapp test.
Here is a similar gist that can easily be tested against geth, remix, parity, etc. (I've tested functionality on Rinkeby, a local geth node, remix JS vm, and ganache with no errors).

Running 2 tests for src/ProxyTest.t.sol:ProxyTest
PASS testFooMaster() (gas: 3061)
FAIL testFooProxy()

Failure: testFooProxy
  
  "Error: Wrong `uint' value"
    Expected: 42
      Actual: ~1.57294584e75
  
  src/ProxyTest.t.sol:ProxyTest
   ├╴constructor
   ├╴initialize test
   │  ├╴create Foo (src/ProxyTest.t.sol:58)
   │  └╴create Proxy (src/ProxyTest.t.sol:59)
   └╴testFooProxy()
      ├╴call Proxy::[unknown method](0x037a417c) (src/ProxyTest.t.sol:68)
      │  ├╴call Foo::testFunc()() (src/ProxyTest.t.sol:34)
      │  │  └╴← uint256 0x
      │  └╴← 0x037a417c00000000000000000000000000000000000000000000000000000000
      ├╴log_bytes32("Error: Wrong `uint' value") (lib/ds-test/src/test.sol:112)
      ├╴log_named_uint("  Expected", 42) (lib/ds-test/src/test.sol:113)
      └╴log_named_uint("    Actual", 1572945844198690166654652573502116276175073521308400342885302740072649457664) (lib/ds-test/src/test.sol:114)

Thanks!

PS - Origination of this contract started around here.
Proxy code from Gnosis repo.
In depth article on the contract above.

from dapptools.

livnev avatar livnev commented on September 7, 2024

@cmditch running the gist you provided with dapp test has both tests succeeding:

$ dapp test
+ dapp clean
+ rm -rf out
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --abi --bin --bin-runtime = -o out/ src/ProxyTest.t.sol
src/ProxyTest.t.sol:47:3: Warning: Function state mutability can be restricted to pure
  function testFunc() public view returns(uint) {
  ^ (Relevant source part starts here and spans across multiple lines).
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/ProxyTest.t.sol
src/ProxyTest.t.sol:47:3: Warning: Function state mutability can be restricted to pure
  function testFunc() public view returns(uint) {
  ^ (Relevant source part starts here and spans across multiple lines).
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --abi --bin --bin-runtime = -o out/ src/ProxyTest.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/ProxyTest.sol
Running 2 tests for src/ProxyTest.t.sol:ProxyTest
PASS testFooMaster() (gas: 3061)
PASS testFooProxy() (gas: 5266)

Are you sure everything is OK with your set up and you are testing the same source code? What is your version of dapp? I have:

$ dapp --version
dapp 0.9.0
solc, the solidity compiler commandline interface
Version: 0.4.24+commit.e67f0147.Linux.g++

from dapptools.

cmditch avatar cmditch commented on September 7, 2024

@livnev how odd. Mine is the same (barring clang/g++):

λ dapp --version
dapp 0.9.0
solc, the solidity compiler commandline interface
Version: 0.4.24+commit.e67f0147.Darwin.clang

also

λ ls $(which hevm)
lrwxr-xr-x  1 root  wheel    62B Dec 31  1969 /Users/cmditch/.nix-profile/bin/hevm -> /nix/store/m01yj3cva83r3vmh72lq3fh58zifsnzv-hevm-0.15/bin/hevm

Update 2 - My coworker was able to get a pass too. Looking to wipe my env, and start fresh.
Update 1 - created a fresh folder. dapp init. added contract. dapp test. same error. :\

λ dapp test
+ dapp clean
+ rm -rf out
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --abi --bin --bin-runtime = -o out/ src/ProxyTest.t.sol
src/ProxyTest.t.sol:51:5: Warning: Function state mutability can be restricted to pure
    function testFunc() public view returns(uint) {
    ^ (Relevant source part starts here and spans across multiple lines).
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/ProxyTest.t.sol
src/ProxyTest.t.sol:51:5: Warning: Function state mutability can be restricted to pure
    function testFunc() public view returns(uint) {
    ^ (Relevant source part starts here and spans across multiple lines).
Running 2 tests for src/ProxyTest.t.sol:ProxyTest
PASS testFooMaster() (gas: 3061)
FAIL testFooProxy()

Failure: testFooProxy
  
  "Error: Wrong `uint' value"
    Expected: 42
      Actual: ~1.57294584e75
  
  src/ProxyTest.t.sol:ProxyTest
   ├╴constructor
   ├╴initialize test
   │  ├╴create Foo (src/ProxyTest.t.sol:62)
   │  └╴create Proxy (src/ProxyTest.t.sol:63)
   └╴testFooProxy()
      ├╴call Proxy::[unknown method](0x037a417c) (src/ProxyTest.t.sol:72)
      │  ├╴call Foo::testFunc()() (src/ProxyTest.t.sol:38)
      │  │  └╴← uint256 0x
      │  └╴← 0x037a417c00000000000000000000000000000000000000000000000000000000
      ├╴log_bytes32("Error: Wrong `uint' value") (lib/ds-test/src/test.sol:112)
      ├╴log_named_uint("  Expected", 42) (lib/ds-test/src/test.sol:113)
      └╴log_named_uint("    Actual", 1572945844198690166654652573502116276175073521308400342885302740072649457664) (lib/ds-test/src/test.sol:114)

from dapptools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.