Skip to content

Commit

Permalink
Merge pull request #481 from ergoplatform/i456
Browse files Browse the repository at this point in the history
Invalid block application test.
  • Loading branch information
oskin1 authored Oct 5, 2018
2 parents 05a08cd + 3752fa4 commit 6e50c52
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
5 changes: 0 additions & 5 deletions src/it/resources/parameters-template.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
paths:

/blocks:
skip: True
post:
- |
{
Expand Down Expand Up @@ -743,12 +742,10 @@ paths:
- count: @lastHeadersCount

/blocks/at/{blockHeight}:
skip: True
path_parameters:
- blockHeight: @blockHeight

/blocks/{headerId}:
skip: True
path_parameters:
- headerId: @headerId

Expand All @@ -757,7 +754,6 @@ paths:
- headerId: @headerId

/blocks/{headerId}/transactions:
skip: True
path_parameters:
- headerId: @headerId

Expand All @@ -766,7 +762,6 @@ paths:
- '"127.0.0.1:5673"'

/transactions:
skip: True
post:
- |
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ class ErgoNodeViewHolderSpec extends ErgoPropertyTest with NodeViewTestOps with
getHeightOf(block.header.id) shouldBe Some(0)
}

val cases: List[TestCase] = List(t1, t2, t3, t4, t5, t6, /*t7,*/ t8, t9)
val cases: List[TestCase] = List(t1, t2, t3, t4, t5, t6, t7, t8, t9)
NodeViewTestConfig.allConfigs.foreach { c =>
cases.foreach { t =>
property(s"${t.name} - $c") {
Expand Down
7 changes: 5 additions & 2 deletions src/test/scala/org/ergoplatform/utils/ErgoGenerators.scala
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ trait ErgoGenerators extends CoreGenerators with Matchers {
x
}

def genSecureBoundedBytes(minSize: Int, maxSize: Int): Gen[Array[Byte]] =
Gen.choose(minSize, maxSize).flatMap { scorex.util.Random.randomBytes }

def kvGen(keySize: Int, valuesSize: Int): Gen[(Array[Byte], Array[Byte])] = for {
key <- genBytes(keySize)
value <- genBytes(valuesSize)
key <- genSecureBoundedBytes(keySize, keySize)
value <- genSecureBoundedBytes(valuesSize, valuesSize)
} yield (key, value)

lazy val extensionGen: Gen[Extension] = for {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ trait NodeViewTestOps extends NodeViewBaseOps {
def getBestHeaderOpt(implicit ctx: Ctx): Option[Header] = getHistory.bestHeaderOpt
def getPoolSize(implicit ctx: Ctx): Int = getCurrentView.pool.size
def getRootHash(implicit ctx: Ctx): String = Algos.encode(getCurrentState.rootHash)
def getBestFullBlockOpt(implicit ctx: Ctx): Option[ErgoFullBlock] = getHistory.bestFullBlockOpt
def getBestFullBlockOpt(implicit ctx: Ctx): Option[ErgoFullBlock] = getHistory.bestFullBlockOpt
def getBestFullBlockEncodedId(implicit ctx: Ctx): Option[String] = getBestFullBlockOpt.map(_.header.encodedId)
def getOpenSurfaces(implicit ctx: Ctx): Seq[scorex.core.ModifierId] = getHistory.openSurfaceIds()
def getHistoryHeight(implicit ctx: Ctx): Int = getHistory.headersHeight
Expand Down

0 comments on commit 6e50c52

Please sign in to comment.