-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restrict democracy create vote #50
Conversation
Allow only token holders to create votes.
Add tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good!
assert.equal(err.receipt.status, 0, "It should have thrown") | ||
return | ||
} | ||
assert.isFalse(true, "It should have thrown") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be nice just to use the assertRevert
helpers we use in aragon-apps
(it's published as @aragon/test-helpers
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I recall correctly, that was not working with the geth node in our docker image.
@@ -20,7 +20,13 @@ const getContract = name => artifacts.require(name) | |||
|
|||
const pct16 = x => new web3.BigNumber(x).times(new web3.BigNumber(10).toPower(16)) | |||
const getEventResult = (receipt, event, param) => receipt.logs.filter(l => l.event == event)[0].args[param] | |||
const createdVoteId = receipt => getEventResult(receipt, 'StartVote', 'voteId') | |||
const getVoteId = (receipt) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does getEventResult()
not work for getting this? I was under the impressions truffle would parse the logs for us.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it was not working, because it's not the "first" call (now we are forwarding trough TokenManager
), so logs don't show up in receipt.logs.filter
and we have to look for them in receipt.receipt.logs
instead.
It looks like the democracy CI is failing due to low account balance issues, which definitely seems weird :/. |
Yes, I don't know what's going on with CI, tests are passing locally for me. I'll try to figure it out. |
await web3.eth.sendTransaction({ from: owner, to: holder20, value: web3.toWei(10, 'ether') }) | ||
await web3.eth.sendTransaction({ from: owner, to: holder29, value: web3.toWei(10, 'ether') }) | ||
await web3.eth.sendTransaction({ from: owner, to: holder51, value: web3.toWei(10, 'ether') }) | ||
await web3.eth.sendTransaction({ from: owner, to: nonHolder, value: web3.toWei(10, 'ether') }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haha, yes, so much time wasted for such an easy solution. Anyway, I still think there's something weird going on here, because it was randomly failing and because if I'm not wrong the transaction which failed was casting a vote and the account performing it had 0.6 ETH (don't know what gas price we have at that node but it should be quite high).
Given that we have now merged this into master and we will be redeploying kits this week, we would need to update the user doc to reflect this change in 0.6.2 cc @john-light |
Allow only token holders to create votes.
Fixes #53