Skip to content

Commit c27ea5b

Browse files
committed
fix test 'validation of field value sizes'
1 parent 643078e commit c27ea5b

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/test/scala/org/ergoplatform/nodeView/state/ErgoStateContextSpec.scala

+8-9
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,26 @@ class ErgoStateContextSpec extends HistoryTestHelpers {
5858
fb.copy(extension = newExtension)
5959
}
6060

61-
// stress-test to trigger sporadic failure https://github.com/ergoplatform/ergo/issues/2114
62-
for (i <- 1 to 10000) {
63-
i == i // leave this, otherwise strange failures
61+
// regression stress-test for sporadic failure https://github.com/ergoplatform/ergo/issues/2114
62+
for (i <- 1 to 1000) {
6463

6564
// checks, specific for extension
6665
// validation of field keys size
6766
val imvKey = extensionKvGen(Extension.FieldKeySize - 1, Extension.FieldValueMaxSize).sample.get
6867
sc.appendFullBlock(fbWithFields(imvKey +: oldFields)) shouldBe 'failure
6968

7069
// https://github.com/ergoplatform/ergo/issues/2114
71-
// this fails sporadically, but the mechanism of failure is different from the one further below
72-
// TODO: find cause, provide workaround/fix
73-
// disabling for now
74-
/*
70+
// this fails sporadically, when `(imvValue._1.head == 0)`, because less value bytes will be generated
71+
// by extensionKvGen(). Workaround is to just generate again while `(imvValue._1.head == 0)`
72+
// TODO: document, and possibly rewrite extensionKvGen after the above issues are clarified/solved
73+
// https://github.com/ergoplatform/ergo/issues/2118
74+
7575
// validation of field value sizes
7676
var imvValue = extensionKvGen(Extension.FieldKeySize, Extension.FieldValueMaxSize + 1).sample.get
77-
while (imvValue._1.head == 1) {
77+
while (imvValue._1.head == 0) {
7878
imvValue = extensionKvGen(Extension.FieldKeySize, Extension.FieldValueMaxSize + 1).sample.get
7979
}
8080
sc.appendFullBlock(fbWithFields(imvValue +: oldFields)) shouldBe 'failure
81-
*/
8281

8382
// validation of incorrect interlinks
8483
val invalidInterlinks = nipopowAlgos.interlinksToExtension(

0 commit comments

Comments
 (0)