diff --git a/contracts/votingMachines/GenesisProtocolInterface.sol b/contracts/votingMachines/GenesisProtocolInterface.sol new file mode 100644 index 0000000..58a7ea3 --- /dev/null +++ b/contracts/votingMachines/GenesisProtocolInterface.sol @@ -0,0 +1,11 @@ +pragma solidity 0.5.17; + + +contract GenesisProtocolInterface { + function setParameters( + uint[11] calldata _params, //use array here due to stack too deep issue. + address _voteOnBehalf + ) + external + returns(bytes32); +} diff --git a/contracts/votingMachines/GenesisProtocolLogic.sol b/contracts/votingMachines/GenesisProtocolLogic.sol index 80e18fe..f2c0663 100644 --- a/contracts/votingMachines/GenesisProtocolLogic.sol +++ b/contracts/votingMachines/GenesisProtocolLogic.sol @@ -264,6 +264,12 @@ contract GenesisProtocolLogic is IntVoteInterface { require(_params[9] > 0, "daoBountyConst should be > 0"); bytes32 paramsHash = getParametersHash(_params, _voteOnBehalf); + + if (parameters[paramsHash].queuedVoteRequiredPercentage > 0) { + //parameters already been set + return paramsHash; + } + //set a limit for power for a given alpha to prevent overflow uint256 limitExponent = 172;//for alpha less or equal 2 uint256 j = 2; diff --git a/package-lock.json b/package-lock.json index ac60690..958fcf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@daostack/infra", - "version": "0.0.1-rc.19", + "version": "0.0.1-rc.20", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 6f2327c..a8433a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@daostack/infra", - "version": "0.0.1-rc.19", + "version": "0.0.1-rc.20", "description": "Base layer DAO's components", "files": [ "contracts/", diff --git a/test/genesisprotocol.js b/test/genesisprotocol.js index b91e132..fe58c60 100644 --- a/test/genesisprotocol.js +++ b/test/genesisprotocol.js @@ -618,6 +618,22 @@ contract('GenesisProtocol', accounts => { it("Non-existent parameters hash shouldn't work - propose with wrong organization", async function() { var testSetup = await setup(accounts); + await testSetup.genesisProtocolCallbacks.setParameters( + [ + 50, + 60, + 60, + 0, + 2000, + 0, + 60, + 10, + 15, + 1000, + 0 + ], + helpers.NULL_ADDRESS + ); await testSetup.genesisProtocolCallbacks.propose(2, testSetup.genesisProtocolParams.paramsHash,helpers.NULL_ADDRESS,accounts[0],helpers.NULL_ADDRESS); try {