Thetta / Thetta-DAO-Framework

Thetta - an open-source framework to help you build the DAO of your dreams
https://web.thetta.io
MIT License
117 stars 28 forks source link

Votings: somehow memory is corrupted (see QuadraticVoting) that result in 'out of gas' error #151

Closed AnthonyAkentiev closed 6 years ago

AnthonyAkentiev commented 6 years ago

Branch is here - dev2-memory-fix

Take it and run tests. What i did - https://github.com/Thetta/Thetta-DAO-Framework/commit/14be1615d5e44d861d7148c802022c2b499bdc7f

I just added additional voting to the GenericCaller:

        if(VotingType.VotingQuadratic==vp.votingType){
            return new Voting_Quadratic(dao, _proposal, _origin, 
                uint(vp.param1), 
                uint(vp.param3), 
                uint(vp.param4), 
                address(vp.param5));
        }
AnthonyAkentiev commented 6 years ago
  1. move bytes32ToString to library
  2. remove _origin
  3. Any number of parameters in VotingParams:
    mapping (uint=>bytes32) params
  4. Pass 'gc' in constructor to voting instead of parameters.
    if(VotingType.VotingSimpleToken==vp.votingType){          
    return new Voting_SimpleToken(dao,   _proposal, _origin,
             uint(vp.param1),
             uint(vp.param3),
             uint(vp.param4),
             address(vp.param5),
             false);
       }

    =>

return new Voting_SimpleToken(dao, _proposal, _origin, this);
  1. Custom types for parameters. Remove converts.

    mapping (ID=>uint) mUint;
    mapping (ID=>bool) mBool;
    ...
  2. Move generic code/vars to Voting()

  3. Create single Voting contract