Skip to content
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

Merged
merged 3 commits into from
Dec 12, 2018
Merged

Conversation

bingen
Copy link
Contributor

@bingen bingen commented Dec 1, 2018

Allow only token holders to create votes.
Fixes #53

Allow only token holders to create votes.
Copy link
Contributor

@sohkai sohkai left a 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")
Copy link
Contributor

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)

Copy link
Contributor Author

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) => {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

@sohkai
Copy link
Contributor

sohkai commented Dec 2, 2018

It looks like the democracy CI is failing due to low account balance issues, which definitely seems weird :/.

@bingen
Copy link
Contributor Author

bingen commented Dec 11, 2018

Yes, I don't know what's going on with CI, tests are passing locally for me. I'll try to figure it out.

@bingen bingen merged commit 219e587 into master Dec 12, 2018
@sohkai sohkai deleted the restrict_democracy_create_vote branch December 12, 2018 15:15
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') })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄

Copy link
Contributor Author

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).

@izqui
Copy link
Contributor

izqui commented Dec 12, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants