stonecoldpat / anonymousvoting

Anonymous voting on Ethereum without a tally authority. Protocol from this paper http://homepages.cs.ncl.ac.uk/feng.hao/files/OpenVote_IET.pdf
340 stars 88 forks source link

Change function modifiers and condition checking instruction #16

Open chrsow opened 6 years ago

chrsow commented 6 years ago

There are two changes in the commit

  1. Use require() and assert() instead of throw for condition checking
    • Since the solidity version from 0.4.10 onwards supports require() and assert(). Those two function will refunds gas in case of an error occurs.

Ref: http://solidity.readthedocs.io/en/develop/control-structures.html#error-handling-assert-require-revert-and-exceptions

  1. Change functions modifiers 'view' and pure instead of constant
    • Version 0.4.17 supports view and pure which has more clear leading word than constant.

Ref: http://solidity.readthedocs.io/en/develop/miscellaneous.html#modifiers

stonecoldpat commented 6 years ago

Hey thanks for doing this! I'll test out the changes (and check everything is working with latest solidity) before committing them

fedorloshakov commented 6 years ago

@chrsow, how did you compile smart contract? Because I also tried to compile in Etherium Wallet and received warning message: Warning: Jump instructions are low-level EVM features that can lead to incorrect stack access. Because of that they are discouraged. Please consider using “switch” or “for” statements instead. jumpi(end, iszero(bit)) ^---^ The same warning for jump assembly command.