Skip to content

Commit

Permalink
PM-3063: Renamed basic protocol test and made it available to service…
Browse files Browse the repository at this point in the history
… tests.
  • Loading branch information
aakoshh committed May 14, 2021
1 parent d5fa658 commit aa06d10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
5 changes: 4 additions & 1 deletion build.sc
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,10 @@ class MetronomeModule(val crossScalaVersion: String) extends CrossScalaModule {
hotstuff.forensics
)

object test extends TestModule
object test extends TestModule {
override def moduleDeps: Seq[JavaModule] =
super.moduleDeps ++ Seq(hotstuff.consensus.test)
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import scala.annotation.nowarn
import scala.concurrent.duration._
import scala.util.{Try, Failure, Success}

object HotStuffProtocolProps extends Properties("Basic HotStuff") {
object ProtocolStateProps extends Properties("Basic HotStuff") {

property("protocol") = HotStuffProtocolCommands.property()
property("protocol") = ProtocolStateCommands.property()

}

Expand All @@ -26,7 +26,7 @@ object HotStuffProtocolProps extends Properties("Basic HotStuff") {
* and invalid commands using `genCommand`. Each `Command`, has its individual post-condition
* check comparing the model state to the actual protocol results.
*/
object HotStuffProtocolCommands extends Commands {
object ProtocolStateCommands extends Commands {

case class TestBlock(blockHash: Int, parentBlockHash: Int, command: String)

Expand Down Expand Up @@ -71,12 +71,10 @@ object HotStuffProtocolCommands extends Commands {
(phase, viewNumber, blockHash).hashCode

private def isGenesis(
phase: VotingPhase,
viewNumber: ViewNumber,
blockHash: TestAgreement.Hash
): Boolean =
phase == genesisQC.phase &&
viewNumber == genesisQC.viewNumber &&
viewNumber == genesisQC.viewNumber &&
blockHash == genesisQC.blockHash

private def sign(
Expand Down Expand Up @@ -125,7 +123,7 @@ object HotStuffProtocolCommands extends Commands {
viewNumber: ViewNumber,
blockHash: TestAgreement.Hash
): Boolean = {
if (isGenesis(phase, viewNumber, blockHash)) {
if (isGenesis(viewNumber, blockHash)) {
signature.sig.isEmpty
} else {
val h = hash(phase, viewNumber, blockHash)
Expand Down

0 comments on commit aa06d10

Please sign in to comment.