question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

pollEnded returns true when invoked with pollIDs of non-existant polls

See original GitHub issue
    it('should throw an error if the poll does not exist', async () => {
      const plcr = await utils.getPLCRInstance();

      const options = defaultOptions();
      options.actor = bob;

      try {
        const ended = await plcr.pollEnded.call('9001'); // this returns true
        assert(false, 'should have thrown error for non-existant poll #9001');
      } catch (err) {
        assert(utils.isEVMException(err), err.toString());
      }
    });

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
skmgoldincommented, Sep 21, 2017

Good advice @yorhodes. We decided to add an explicit function for it. Doing it in isExpired seemed slightly non-idiomatic to that function’s purpose.

https://github.com/ConsenSys/PLCRVoting/commit/b1a05e8ace28a5a6b991ba0435389a4dd73568b8

0reactions
kangarangcommented, Sep 21, 2017

Indeed, implementing the check in isExpired is cleaner, and all tests pass.

function isExpired(uint _terminationDate) constant public returns (bool expired) {
    require(_terminationDate > 0);
    return (block.timestamp > _terminationDate);
}

I like this solution! @skmgoldin, how should we proceed?

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 key things to know about the margin of error in election polls
In presidential elections, even the smallest changes in horse-race poll results seem to become imbued with deep meaning.
Read more >
What to Expect on Election Day in Texas
In Texas, results from Early Voting are submitted by Texas counties and reported first, shortly after polls close on Election Night.
Read more >
Forecasting a Presidential Election with Monte Carlo Simulation
Learn about how computers generate "random" numbers, and use Monte Carlo simulation to simulate the US Presidential Election using polling data.
Read more >
What polling does — and doesn't — tell us | PBS NewsHour
With control of Congress at stake in this year's midterm elections, polls gauging whether people favor Republicans or Democrats are being ...
Read more >
Is True the Vote Intimidating Minority Voters From Going to the ...
A former poll worker and a Democrat, she says she has voted in every election since she was 18. "Voting to me is,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found