-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add election result validator #1548
Add election result validator #1548
Conversation
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.
Just a few things that should lighten the code a bit ;)
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
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.
Just a few things that should lighten the code a bit ;)
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.
Only some nitpicks, othw all good
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/test/scala/util/examples/JsonRpcRequestExample.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
da327d9
to
d448214
Compare
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
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 is still some changes to do. Do not hesitate to ask me questions if some of my comments are not clear :))
Also, I was wondering, should we also check if our ballot options in the ResultElection correspond to the ballot options in our SetupElection?
We can have the case, where all ids are checked and everything passed, but we do not have any ballot that are coherent. What do you think?
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidatorSuite.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
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 is some changes to do still. Do not hesitate to ask me questions if some of my comments are not clear :))
Also, I was wondering, should we also check if our ballot options in the ResultElection correspond to the ballot options in our SetupElection?
We can have the case, where all ids are checked and everything passed, but we do not have any ballot that are coherent. What do you think?
@Ajkunas indeed, since ballot options are not used in the question id's computation, we can add a check for ballot options consistency. |
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.
Some nitpicks and some comments. ;)
You have a lot of already defined functions in Scala, try to take a look at the documentation when you want to implement smth, your code could be more concise.
Othw, good job :)
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidatorSuite.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/test/scala/util/examples/JsonRpcRequestExample.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
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.
Still some nitpicks to correct. After taking in consideration my comments, I will be happy to approve the PR.
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/main/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidator.scala
Outdated
Show resolved
Hide resolved
be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidatorSuite.scala
Outdated
Show resolved
Hide resolved
@@ -10,6 +11,8 @@ import util.examples.Election.OpenElectionExamples._ | |||
import util.examples.Election.SetupElectionExamples.{ELECTION_ID, _} | |||
import util.examples.Election.EndElectionExamples._ | |||
import util.examples.Election.KeyElectionExamples._ | |||
import util.examples.Election.ResultElectionExamples._ | |||
import util.examples.Election.{ResultElectionExamples, SetupElectionExamples} |
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.
You could remove this line, since it is a repetition of previous lines (line 14 and line 11).
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.
Okay, but now why do you include SetupElectionExamples
? You already import it in line 10.
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.
Last nitpicks :)
@@ -10,6 +11,8 @@ import util.examples.Election.OpenElectionExamples._ | |||
import util.examples.Election.SetupElectionExamples.{ELECTION_ID, _} | |||
import util.examples.Election.EndElectionExamples._ | |||
import util.examples.Election.KeyElectionExamples._ | |||
import util.examples.Election.ResultElectionExamples._ | |||
import util.examples.Election.{ResultElectionExamples, SetupElectionExamples} |
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.
Okay, but now why do you include SetupElectionExamples
? You already import it in line 10.
be2-scala/src/test/scala/ch/epfl/pop/pubsub/graph/validators/ElectionValidatorSuite.scala
Outdated
Show resolved
Hide resolved
[PoP - Be2-Scala] Kudos, SonarCloud Quality Gate passed! |
[PoP - Be1-Go] Kudos, SonarCloud Quality Gate passed! |
[PoP - Fe2-Android] Kudos, SonarCloud Quality Gate passed! |
[PoP - Fe1-Web] Kudos, SonarCloud Quality Gate passed! |
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.
LGTM
This pull request is about the decentralized communication part.
The new server to server architecture implies servers receiving ResultElection messages, which previously were never received by a server. This pull request implements and tests the ResultElection Validator.