Skip to content

Commit

Permalink
Revert.
Browse files Browse the repository at this point in the history
  • Loading branch information
OStevan committed Aug 12, 2020
1 parent 1747736 commit 27c913f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import ch.epfl.ognjanovic.stevan.tendermint.verified.light.VotingPowerVerifiers
import ch.epfl.ognjanovic.stevan.tendermint.verified.types._
import stainless.annotation._
import stainless.lang._
import stainless.lang.StaticChecks.assert
import utils.ListSet

object BlockchainStates {
Expand Down Expand Up @@ -131,8 +132,8 @@ object BlockchainStates {
blockchain.faultChecker.isCorrect(nextValidatorSet, faulty)
) {
val newBlockchain = blockchain.appendBlock(lastCommit, nextValidatorSet)
// assert(newBlockchain.chain.head.validatorSet.keys.subsetOf(allNodes))
// assert(globalStateInvariant(allNodes, faulty, newBlockchain))
assert(newBlockchain.chain.head.validatorSet.keys.subsetOf(allNodes))
assert(globalStateInvariant(allNodes, faulty, newBlockchain))

if (newBlockchain.finished)
Finished(allNodes, faulty, newBlockchain)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ object ModelIntegration {
val verifiedState: VerifiedState =
SimpleVerifiedState(trustedSignedHeader, VotingPowerVerifiers.defaultVotingPowerVerifier)
val untrustedTrace = InMemoryUntrustedTrace(heightToVerify, List.empty)
// assert(untrustedTrace.bottomHeight().forall(heightToVerify < _))
// assert(verifiedState.currentHeight() < heightToVerify)
// assert(heightToVerify <= untrustedTrace.targetLimit)
assert(untrustedTrace.bottomHeight().forall(heightToVerify < _))
assert(verifiedState.currentHeight() < heightToVerify)
assert(heightToVerify <= untrustedTrace.targetLimit)

val lightBlockVerifier = DefaultTrustVerifier()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package ch.epfl.ognjanovic.stevan.tendermint.verified.light

import ch.epfl.ognjanovic.stevan.tendermint.verified.types.{Height, LightBlock, PeerId}
import stainless.lang.StaticChecks._
import stainless.annotation._

object LightBlockProviders {

abstract class LightBlockProvider {

@pure
def lightBlock(height: Height): LightBlock = {
require(height <= currentHeight)
??? : LightBlock
Expand All @@ -16,6 +17,7 @@ object LightBlockProviders {

def currentHeight: Height

@pure
def chainId: String

def peerId: PeerId
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ case class MultiStepVerifier(

val nextHeight = untrustedTrace.targetLimit

// assert(untrustedTrace.bottomHeight().map(nextHeight < _).getOrElse(true))
// assert(verifiedState.currentHeight() < nextHeight)
// assert(nextHeight <= untrustedTrace.targetLimit)
assert(untrustedTrace.bottomHeight().map(nextHeight < _).getOrElse(true))
assert(verifiedState.currentHeight() < nextHeight)
assert(nextHeight <= untrustedTrace.targetLimit)
verify(WaitingForHeader(nextHeight, verifiedState, untrustedTrace))
}
}
Expand Down Expand Up @@ -82,7 +82,7 @@ case class MultiStepVerifier(
decreases(untrustedTrace.targetLimit.value - verifiedState.currentHeight().value)

val lightBlock = lightBlockProvider.lightBlock(next)
// assert(lightBlock.header.height == next)
assert(lightBlock.header.height == next)

// without a caching light block provider this is extremely wasteful but the algorithm is simpler.
verifier.verify(verifiedState, lightBlock) match {
Expand Down

0 comments on commit 27c913f

Please sign in to comment.