Skip to content

Commit

Permalink
fix test 'validation of field value sizes'
Browse files Browse the repository at this point in the history
  • Loading branch information
stenolog committed Feb 26, 2024
1 parent 643078e commit c27ea5b
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,26 @@ class ErgoStateContextSpec extends HistoryTestHelpers {
fb.copy(extension = newExtension)
}

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

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

// https://github.com/ergoplatform/ergo/issues/2114
// this fails sporadically, but the mechanism of failure is different from the one further below
// TODO: find cause, provide workaround/fix
// disabling for now
/*
// this fails sporadically, when `(imvValue._1.head == 0)`, because less value bytes will be generated
// by extensionKvGen(). Workaround is to just generate again while `(imvValue._1.head == 0)`
// TODO: document, and possibly rewrite extensionKvGen after the above issues are clarified/solved
// https://github.com/ergoplatform/ergo/issues/2118

// validation of field value sizes
var imvValue = extensionKvGen(Extension.FieldKeySize, Extension.FieldValueMaxSize + 1).sample.get
while (imvValue._1.head == 1) {
while (imvValue._1.head == 0) {
imvValue = extensionKvGen(Extension.FieldKeySize, Extension.FieldValueMaxSize + 1).sample.get
}
sc.appendFullBlock(fbWithFields(imvValue +: oldFields)) shouldBe 'failure
*/

// validation of incorrect interlinks
val invalidInterlinks = nipopowAlgos.interlinksToExtension(
Expand Down

0 comments on commit c27ea5b

Please sign in to comment.