diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index a7d763f5153..8928ec5ce3f 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -3,7 +3,7 @@ name: Feature request about: Suggest an idea for this project title: '' labels: feature -assignees: pivoo81 +assignees: phearnot --- diff --git a/grpc-server/src/test/scala/com/wavesplatform/events/BlockchainUpdatesSpec.scala b/grpc-server/src/test/scala/com/wavesplatform/events/BlockchainUpdatesSpec.scala index 7ef8910792f..35d087f2882 100644 --- a/grpc-server/src/test/scala/com/wavesplatform/events/BlockchainUpdatesSpec.scala +++ b/grpc-server/src/test/scala/com/wavesplatform/events/BlockchainUpdatesSpec.scala @@ -212,9 +212,7 @@ class BlockchainUpdatesSpec extends FreeSpec with WithBUDomain with ScalaFutures } } - "should survive invalid rollback" in withDomainAndRepo( - SettingsFromDefaultConfig.copy(dbSettings = SettingsFromDefaultConfig.dbSettings.copy(maxRollbackDepth = 0)) - ) { (d, repo) => + "should survive invalid rollback" in withDomainAndRepo(RideV6.copy(dbSettings = dbSettings.copy(maxRollbackDepth = 0))) { (d, repo) => for (_ <- 1 to 10) d.appendBlock() intercept[RuntimeException](d.rollbackTo(1)) // Should fail d.appendBlock() diff --git a/lang/js/src/main/scala/JsAPI.scala b/lang/js/src/main/scala/com/wavesplatform/JsAPI.scala similarity index 99% rename from lang/js/src/main/scala/JsAPI.scala rename to lang/js/src/main/scala/com/wavesplatform/JsAPI.scala index 92a8d947a3a..7a5f3eae35d 100644 --- a/lang/js/src/main/scala/JsAPI.scala +++ b/lang/js/src/main/scala/com/wavesplatform/JsAPI.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import JsApiUtils.* import com.wavesplatform.DocSource import com.wavesplatform.lang.* diff --git a/lang/js/src/main/scala/JsApiUtils.scala b/lang/js/src/main/scala/com/wavesplatform/JsApiUtils.scala similarity index 90% rename from lang/js/src/main/scala/JsApiUtils.scala rename to lang/js/src/main/scala/com/wavesplatform/JsApiUtils.scala index fdf15621f4d..68d66f78eae 100644 --- a/lang/js/src/main/scala/JsApiUtils.scala +++ b/lang/js/src/main/scala/com/wavesplatform/JsApiUtils.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import com.wavesplatform.lang.contract.DApp import com.wavesplatform.lang.v1.FunctionHeader.{Native, User} import com.wavesplatform.lang.v1.compiler.CompilationError @@ -14,7 +16,7 @@ import scala.scalajs.js.JSConverters._ object JsApiUtils { def serPart[T](f: T => js.Any)(part: PART[T]): js.Object = { - val partValue = Expressions.PART.toOption(part).fold(null:Any)(f) + val partValue = Expressions.PART.toOption(part).fold(null: Any)(f) jObj.applyDynamic("apply")( "value" -> partValue, "posStart" -> part.position.start, @@ -55,11 +57,11 @@ object JsApiUtils { } jObj.applyDynamic("apply")( - "type" -> "DAPP", - "posStart" -> ast.position.start, - "posEnd" -> ast.position.end, - "decList" -> ast.decs.map(serDec).toJSArray, - "annFuncList" -> ast.fs.map(serAnnFunc).toJSArray + "type" -> "DAPP", + "posStart" -> ast.position.start, + "posEnd" -> ast.position.end, + "decList" -> ast.decs.map(serDec).toJSArray, + "annFuncList" -> ast.fs.map(serAnnFunc).toJSArray ) } @@ -146,8 +148,8 @@ object JsApiUtils { case Expressions.FOLD(_, limit, value, acc, func, _, _) => val additionalDataObj = jObj.applyDynamic("apply")( - "name" -> s"FOLD<$limit>", - "args" -> js.Array(serExpr(value), serExpr(acc), func.key.toString: js.Any) + "name" -> s"FOLD<$limit>", + "args" -> js.Array(serExpr(value), serExpr(acc), func.key.toString: js.Any) ) mergeJSObjects(commonDataObj, additionalDataObj) @@ -173,7 +175,9 @@ object JsApiUtils { } def serMatchCase(c: Expressions.MATCH_CASE, simpleCtx: Map[String, Pos]): js.Object = { - val vars = c.pattern.subpatterns.collect { case (Expressions.TypedVar(Some(newVarName), caseType), _) => (serPartStr(newVarName), serType(caseType)) } + val vars = c.pattern.subpatterns.collect { case (Expressions.TypedVar(Some(newVarName), caseType), _) => + (serPartStr(newVarName), serType(caseType)) + } jObj.applyDynamic("apply")( "type" -> "MATCH_CASE", "posStart" -> c.position.start, @@ -200,7 +204,7 @@ object JsApiUtils { t match { case Expressions.AnyType(_) => jObj.applyDynamic("apply")( - "typeName" -> "Any" + "typeName" -> "Any" ) case Expressions.Single(name, parameter) => jObj.applyDynamic("apply")( @@ -255,21 +259,25 @@ object JsApiUtils { def toJs(ast: EXPR): js.Object = { def r(expr: EXPR): js.Object = { expr match { - case CONST_LONG(t) => jObj.applyDynamic("apply")("type" -> "LONG", "value" -> t.toDouble) - case GETTER(ref, field) => jObj.applyDynamic("apply")("type" -> "GETTER", "ref" -> r(ref), "field" -> field) + case CONST_LONG(t) => jObj.applyDynamic("apply")("type" -> "LONG", "value" -> t.toDouble) + case GETTER(ref, field) => jObj.applyDynamic("apply")("type" -> "GETTER", "ref" -> r(ref), "field" -> field) case CONST_BYTESTR(bs) => jObj.applyDynamic("apply")("type" -> "BYTESTR", "value" -> bs.arr.toJSArray) - case CONST_STRING(s) => jObj.applyDynamic("apply")("type" -> "STRING", "value" -> s) + case CONST_STRING(s) => jObj.applyDynamic("apply")("type" -> "STRING", "value" -> s) case LET_BLOCK(let, body) => jObj.applyDynamic("apply")("type" -> "BLOCK", "let" -> jObj("name" -> let.name, "value" -> r(let.value)), "body" -> r(body)) case IF(cond, ifTrue, ifFalse) => jObj.applyDynamic("apply")("type" -> "IF", "condition" -> r(cond), "true" -> r(ifTrue), "false" -> r(ifFalse)) - case REF(key) => jObj.applyDynamic("apply")("type" -> "REF", "key" -> key) + case REF(key) => jObj.applyDynamic("apply")("type" -> "REF", "key" -> key) case CONST_BOOLEAN(b) => jObj.applyDynamic("apply")("type" -> "BOOL", "value" -> b) case FUNCTION_CALL(function, args) => - jObj.applyDynamic("apply")("type" -> "CALL", "name" -> (function match { - case Native(name) => name.toString() - case User(internalName, _) => internalName - }), "args" -> args.map(r).toJSArray) + jObj.applyDynamic("apply")( + "type" -> "CALL", + "name" -> (function match { + case Native(name) => name.toString() + case User(internalName, _) => internalName + }), + "args" -> args.map(r).toJSArray + ) case t => jObj.applyDynamic("apply")("[not_supported]stringRepr" -> t.toString) } } diff --git a/lang/tests-js/src/test/scala/DAppComplexities.scala b/lang/tests-js/src/test/scala/com/wavesplatform/DAppComplexities.scala similarity index 89% rename from lang/tests-js/src/test/scala/DAppComplexities.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/DAppComplexities.scala index 1876fb85215..892522f1c59 100644 --- a/lang/tests-js/src/test/scala/DAppComplexities.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/DAppComplexities.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + case class DAppComplexities( complexity: Int, verifierComplexity: Int, diff --git a/lang/tests-js/src/test/scala/Global.scala b/lang/tests-js/src/test/scala/com/wavesplatform/Global.scala similarity index 91% rename from lang/tests-js/src/test/scala/Global.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/Global.scala index f8a49245087..99a61503521 100644 --- a/lang/tests-js/src/test/scala/Global.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/Global.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import scala.scalajs.js.annotation.JSExportTopLevel import scala.scalajs.js.typedarray.ArrayBuffer diff --git a/lang/tests-js/src/test/scala/JsAPITest.scala b/lang/tests-js/src/test/scala/com/wavesplatform/JsAPITest.scala similarity index 99% rename from lang/tests-js/src/test/scala/JsAPITest.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/JsAPITest.scala index 88f74e9100c..25416408df5 100644 --- a/lang/tests-js/src/test/scala/JsAPITest.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/JsAPITest.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import com.wavesplatform.lang.directives.values.{V5, V6} import utest.* diff --git a/lang/tests-js/src/test/scala/JsTestBase.scala b/lang/tests-js/src/test/scala/com/wavesplatform/JsTestBase.scala similarity index 98% rename from lang/tests-js/src/test/scala/JsTestBase.scala rename to lang/tests-js/src/test/scala/com/wavesplatform/JsTestBase.scala index 6f2e970a747..ac04371ba18 100644 --- a/lang/tests-js/src/test/scala/JsTestBase.scala +++ b/lang/tests-js/src/test/scala/com/wavesplatform/JsTestBase.scala @@ -1,3 +1,5 @@ +package com.wavesplatform + import com.wavesplatform.lang.directives.values.{StdLibVersion, V6} import utest.{TestSuite, assert} diff --git a/node/src/main/scala/com/wavesplatform/Application.scala b/node/src/main/scala/com/wavesplatform/Application.scala index 729949a69e3..af3f6230016 100644 --- a/node/src/main/scala/com/wavesplatform/Application.scala +++ b/node/src/main/scala/com/wavesplatform/Application.scala @@ -215,7 +215,7 @@ class Application(val actorSystem: ActorSystem, val settings: WavesSettings, con .map { case Right(discardedBlocks) => allChannels.broadcast(LocalScoreChanged(blockchainUpdater.score)) - if (returnTxsToUtx) utxStorage.addAndCleanup(discardedBlocks.view.flatMap(_._1.transactionData)) + if (returnTxsToUtx) utxStorage.addAndScheduleCleanup(discardedBlocks.view.flatMap(_._1.transactionData)) Right(discardedBlocks) case Left(error) => Left(error) } diff --git a/node/src/main/scala/com/wavesplatform/state/appender/ExtensionAppender.scala b/node/src/main/scala/com/wavesplatform/state/appender/ExtensionAppender.scala index 36a7e265c27..fa1d2c2abc5 100644 --- a/node/src/main/scala/com/wavesplatform/state/appender/ExtensionAppender.scala +++ b/node/src/main/scala/com/wavesplatform/state/appender/ExtensionAppender.scala @@ -102,7 +102,7 @@ object ExtensionAppender extends ScorexLogging { val newTransactions = newBlocks.view.flatMap(_.transactionData).toSet utxStorage.removeAll(newTransactions) - utxStorage.addAndCleanup(droppedBlocks.flatMap(_._1.transactionData).filterNot(newTransactions)) + utxStorage.addAndScheduleCleanup(droppedBlocks.flatMap(_._1.transactionData).filterNot(newTransactions)) Right(Some(blockchainUpdater.score)) } } diff --git a/node/src/main/scala/com/wavesplatform/state/appender/MicroblockAppender.scala b/node/src/main/scala/com/wavesplatform/state/appender/MicroblockAppender.scala index abcbb8caefb..ebc99c7c4ee 100644 --- a/node/src/main/scala/com/wavesplatform/state/appender/MicroblockAppender.scala +++ b/node/src/main/scala/com/wavesplatform/state/appender/MicroblockAppender.scala @@ -30,11 +30,14 @@ object MicroblockAppender extends ScorexLogging { blockchainUpdater .processMicroBlock(microBlock, verify) .map { totalBlockId => - if (microBlock.transactionData.nonEmpty) log.trace { - s"Removing mined txs from ${microBlock.stringRepr(totalBlockId)}: ${microBlock.transactionData.map(_.id()).mkString(", ")}" + if (microBlock.transactionData.nonEmpty) { + utxStorage.removeAll(microBlock.transactionData) + log.trace( + s"Removing txs of ${microBlock.stringRepr(totalBlockId)} ${microBlock.transactionData.map(_.id()).mkString("(", ", ", ")")} from UTX pool" + ) } - utxStorage.removeAll(microBlock.transactionData) - utxStorage.cleanUnconfirmed() + + utxStorage.scheduleCleanup() totalBlockId } }).executeOn(scheduler) diff --git a/node/src/main/scala/com/wavesplatform/state/appender/package.scala b/node/src/main/scala/com/wavesplatform/state/appender/package.scala index 7b84d1db08b..bfdffe201ce 100644 --- a/node/src/main/scala/com/wavesplatform/state/appender/package.scala +++ b/node/src/main/scala/com/wavesplatform/state/appender/package.scala @@ -39,7 +39,7 @@ package object appender { .map { discardedDiffs => utx.removeAll(block.transactionData) utx.setPriorityDiffs(discardedDiffs) - utx.runCleanup() + utx.scheduleCleanup() Some(blockchainUpdater.height) } } diff --git a/node/src/main/scala/com/wavesplatform/utx/UtxPoolImpl.scala b/node/src/main/scala/com/wavesplatform/utx/UtxPoolImpl.scala index 76cdd573e02..d1e44280af1 100644 --- a/node/src/main/scala/com/wavesplatform/utx/UtxPoolImpl.scala +++ b/node/src/main/scala/com/wavesplatform/utx/UtxPoolImpl.scala @@ -156,11 +156,10 @@ class UtxPoolImpl( log.trace(s"putIfNew(${tx.id()}) succeeded, isNew = $isNew") case Left(err) => log.debug(s"putIfNew(${tx.id()}) failed with ${extractErrorMessage(err)}") - val errMsg = err match { + traceLogger.trace(err match { case w: WithLog => w.toStringWithLog(maxTxErrorLogSize) case err => err.toString - } - traceLogger.trace(errMsg) + }) } tracedIsNew } @@ -528,12 +527,12 @@ class UtxPoolImpl( } /** DOES NOT verify transactions */ - def addAndCleanup(transactions: Iterable[Transaction]): Unit = { + def addAndScheduleCleanup(transactions: Iterable[Transaction]): Unit = { transactions.foreach(addTransaction(_, verify = false)) TxCleanup.runCleanupAsync() } - def runCleanup(): Unit = { + def scheduleCleanup(): Unit = { TxCleanup.runCleanupAsync() } diff --git a/node/src/test/scala/com/wavesplatform/api/common/CommonAccountApiSpec.scala b/node/src/test/scala/com/wavesplatform/api/common/CommonAccountApiSpec.scala index f16bc6e5cac..a293082adf8 100644 --- a/node/src/test/scala/com/wavesplatform/api/common/CommonAccountApiSpec.scala +++ b/node/src/test/scala/com/wavesplatform/api/common/CommonAccountApiSpec.scala @@ -10,9 +10,10 @@ import com.wavesplatform.lang.v1.compiler.TestCompiler import com.wavesplatform.lang.v1.traits.domain.{Lease, Recipient} import com.wavesplatform.settings.TestFunctionalitySettings import com.wavesplatform.state.{DataEntry, Diff, EmptyDataEntry, StringDataEntry, diffs} -import com.wavesplatform.test.DomainPresets.RideV6 +import com.wavesplatform.test.DomainPresets.{RideV4, RideV6} import com.wavesplatform.test.FreeSpec -import com.wavesplatform.transaction.TxHelpers.secondAddress +import com.wavesplatform.transaction.TxHelpers.{data, secondAddress} +import com.wavesplatform.transaction.TxVersion.V2 import com.wavesplatform.transaction.{DataTransaction, GenesisTransaction, TxHelpers} import com.wavesplatform.{BlocksTransactionsHelpers, history} import monix.execution.Scheduler.Implicits.global @@ -25,46 +26,33 @@ class CommonAccountApiSpec extends FreeSpec with WithDomain with BlocksTransacti val entry2 = StringDataEntry("test1", "test") val entry3 = StringDataEntry("test2", "test") - val preconditions = for { - acc <- accountGen - ts = System.currentTimeMillis() - fee <- smallFeeGen - genesis = GenesisTransaction.create(acc.toAddress, diffs.ENOUGH_AMT, ts).explicitGet() - data1 = DataTransaction.selfSigned(1.toByte, acc, Seq(entry1), fee, ts).explicitGet() - data2 = DataTransaction.selfSigned(1.toByte, acc, Seq(entry2), fee, ts).explicitGet() - data3 = DataTransaction.selfSigned(1.toByte, acc, Seq(entry3), fee, ts).explicitGet() - data4 = DataTransaction.selfSigned(2.toByte, acc, Seq(EmptyDataEntry("test"), EmptyDataEntry("test1")), fee, ts).explicitGet() - data5 = DataTransaction.selfSigned(2.toByte, acc, Seq(EmptyDataEntry("test2"), entry1, entry2), fee, ts).explicitGet() - (block1, mbs1) = UnsafeBlocks.unsafeChainBaseAndMicro(history.randomSig, Seq(genesis), Seq(Seq(data1)), acc, 3, ts) - (block2, mbs2) = UnsafeBlocks.unsafeChainBaseAndMicro(mbs1.last.totalResBlockSig, Seq(data2), Seq(Seq(data3)), acc, 3, ts) - (block3, mbs3) = UnsafeBlocks.unsafeChainBaseAndMicro(mbs2.last.totalResBlockSig, Seq(data4), Seq(Seq(data5)), acc, 3, ts) - } yield (acc, block1, mbs1.head, block2, mbs2.head, block3, mbs3.head) + val acc = accountGen.sample.get + val genesis = TxHelpers.genesis(acc.toAddress) + val data1 = data(acc, Seq(entry1)) + val data2 = data(acc, Seq(entry2)) + val data3 = data(acc, Seq(entry3)) + val data4 = data(acc, Seq(EmptyDataEntry("test"), EmptyDataEntry("test1")), version = V2) + val data5 = data(acc, Seq(EmptyDataEntry("test2"), entry1, entry2), version = V2) + - forAll(preconditions) { case (acc, block1, mb1, block2, mb2, block3, mb3) => withDomain( - domainSettingsWithFS( - TestFunctionalitySettings.withFeatures( - BlockchainFeatures.NG, - BlockchainFeatures.DataTransaction, - BlockchainFeatures.BlockV5 - ) - ) + RideV4 ) { d => val commonAccountsApi = CommonAccountsApi(() => d.blockchainUpdater.bestLiquidDiff.getOrElse(Diff.empty), d.db, () => d.blockchainUpdater) def dataList(): Set[DataEntry[_]] = commonAccountsApi.dataStream(acc.toAddress, None).toListL.runSyncUnsafe().toSet - d.appendBlock(block1) - d.appendMicroBlock(mb1) + d.appendBlock(genesis) + d.appendMicroBlock(data1) dataList() shouldBe Set(entry1) - d.appendBlock(block2) + d.appendBlock(data2) dataList() shouldBe Set(entry1, entry2) - d.appendMicroBlock(mb2) + d.appendMicroBlock(data3) dataList() shouldBe Set(entry1, entry2, entry3) - d.appendBlock(block3) + d.appendBlock(data4) dataList() shouldBe Set(entry3) - d.appendMicroBlock(mb3) + d.appendMicroBlock(data5) dataList() shouldBe Set(entry1, entry2) - } + } } diff --git a/node/src/test/scala/com/wavesplatform/history/BlockchainUpdaterSponsoredFeeBlockTest.scala b/node/src/test/scala/com/wavesplatform/history/BlockchainUpdaterSponsoredFeeBlockTest.scala index fba6d82daf6..5f2a716f8cf 100644 --- a/node/src/test/scala/com/wavesplatform/history/BlockchainUpdaterSponsoredFeeBlockTest.scala +++ b/node/src/test/scala/com/wavesplatform/history/BlockchainUpdaterSponsoredFeeBlockTest.scala @@ -1,22 +1,22 @@ package com.wavesplatform.history -import com.wavesplatform.account.KeyPair import com.wavesplatform.common.state.ByteStr import com.wavesplatform.common.utils.EitherExt2 -import com.wavesplatform.crypto._ import com.wavesplatform.features.BlockchainFeatures import com.wavesplatform.history.Domain.BlockchainUpdaterExt import com.wavesplatform.settings.{BlockchainSettings, WavesSettings} -import com.wavesplatform.state._ -import com.wavesplatform.state.diffs._ -import com.wavesplatform.test._ +import com.wavesplatform.state.* +import com.wavesplatform.state.diffs.* +import com.wavesplatform.test.* import com.wavesplatform.transaction.Asset.Waves import com.wavesplatform.transaction.assets.{IssueTransaction, SponsorFeeTransaction} -import com.wavesplatform.transaction.transfer._ +import com.wavesplatform.transaction.transfer.* import com.wavesplatform.transaction.{Asset, GenesisTransaction} import org.scalacheck.Gen class BlockchainUpdaterSponsoredFeeBlockTest extends PropSpec with DomainScenarioDrivenPropertyCheck { + private val time = new TestTime + private def ts = time.getTimestamp() private val amtTx = 100000 @@ -26,7 +26,6 @@ class BlockchainUpdaterSponsoredFeeBlockTest extends PropSpec with DomainScenari val sponsorPreconditions: Gen[Setup] = for { master <- accountGen - ts <- timestampGen transferAssetWavesFee <- smallFeeGen _ <- accountGen alice <- accountGen @@ -90,33 +89,29 @@ class BlockchainUpdaterSponsoredFeeBlockTest extends PropSpec with DomainScenari val SponsoredFeeActivatedAt0BlockchainSettings: BlockchainSettings = DefaultBlockchainSettings.copy( functionalitySettings = DefaultBlockchainSettings.functionalitySettings - .copy(featureCheckBlocksPeriod = 1, blocksForFeatureActivation = 1, preActivatedFeatures = Map( + .copy( + featureCheckBlocksPeriod = 1, + blocksForFeatureActivation = 1, + preActivatedFeatures = Map( BlockchainFeatures.FeeSponsorship.id -> 0, BlockchainFeatures.NG.id -> 0, BlockchainFeatures.BlockV5.id -> 0 - )) + ) + ) ) val SponsoredActivatedAt0WavesSettings: WavesSettings = settings.copy(blockchainSettings = SponsoredFeeActivatedAt0BlockchainSettings) property("not enough waves to sponsor sponsored tx") { scenario(sponsorPreconditions, SponsoredActivatedAt0WavesSettings) { - case (domain, (genesis, masterToAlice, feeAsset, sponsor, aliceToBob, bobToMaster, bobToMaster2)) => - val (block0, microBlocks) = chainBaseAndMicro(randomSig, genesis, Seq(masterToAlice, feeAsset, sponsor).map(Seq(_))) - val block1 = - customBuildBlockOfTxs(microBlocks.last.totalResBlockSig, Seq.empty, KeyPair(Array.fill(KeyLength)(1: Byte)), 3: Byte, sponsor.timestamp + 1) - val block2 = customBuildBlockOfTxs(block1.id(), Seq.empty, KeyPair(Array.fill(KeyLength)(1: Byte)), 3: Byte, sponsor.timestamp + 1) - val block3 = buildBlockOfTxs(block2.id(), Seq(aliceToBob, bobToMaster)) - val block4 = buildBlockOfTxs(block3.id(), Seq(bobToMaster2)) - - domain.blockchainUpdater.processBlock(block0) should beRight - domain.blockchainUpdater.processMicroBlock(microBlocks(0)) should beRight - domain.blockchainUpdater.processMicroBlock(microBlocks(1)) should beRight - domain.blockchainUpdater.processMicroBlock(microBlocks(2)) should beRight - domain.blockchainUpdater.processBlock(block1) should beRight - domain.blockchainUpdater.processBlock(block2) should beRight - domain.blockchainUpdater.processBlock(block3) should beRight - domain.blockchainUpdater.processBlock(block4) should produce("negative waves balance" /*"unavailable funds"*/ ) + case (d, (genesis, masterToAlice, feeAsset, sponsor, aliceToBob, bobToMaster, bobToMaster2)) => + d.appendBlock(genesis) + d.appendBlock() + d.appendMicroBlock(masterToAlice) + d.appendMicroBlock(feeAsset) + d.appendMicroBlock(sponsor) + d.appendBlock(aliceToBob, bobToMaster) + d.appendBlockE(bobToMaster2) should produce("negative waves balance" /*"unavailable funds"*/ ) } } diff --git a/node/src/test/scala/com/wavesplatform/history/Domain.scala b/node/src/test/scala/com/wavesplatform/history/Domain.scala index eef3a965b85..8451ef3b397 100644 --- a/node/src/test/scala/com/wavesplatform/history/Domain.scala +++ b/node/src/test/scala/com/wavesplatform/history/Domain.scala @@ -12,6 +12,7 @@ import com.wavesplatform.consensus.{PoSCalculator, PoSSelector} import com.wavesplatform.database.{DBExt, Keys, LevelDBWriter} import com.wavesplatform.db.TestUtxPool import com.wavesplatform.events.BlockchainUpdateTriggers +import com.wavesplatform.features.BlockchainFeatures.{BlockV5, RideV6} import com.wavesplatform.lagonaki.mocks.TestBlock import com.wavesplatform.lang.ValidationError import com.wavesplatform.lang.script.Script @@ -24,7 +25,7 @@ import com.wavesplatform.transaction.smart.script.trace.TracedResult import com.wavesplatform.transaction.{BlockchainUpdater, *} import com.wavesplatform.utils.{EthEncoding, SystemTime} import com.wavesplatform.wallet.Wallet -import com.wavesplatform.{TestValues, database} +import com.wavesplatform.{TestValues, crypto, database} import monix.execution.Scheduler.Implicits.global import org.iq80.leveldb.DB import org.scalatest.matchers.should.Matchers.* @@ -60,7 +61,7 @@ case class Domain( lazy val utxPool = new TestUtxPool(SystemTime, blockchain, settings.utxSettings, settings.maxTxErrorLogSize, settings.minerSettings.enable, beforeSetPriorityDiffs) - lazy val wallet: Wallet = Wallet(settings.walletSettings.copy(file = None)) + lazy val wallet: Wallet = Wallet(settings.walletSettings.copy(file = None)) def blockchainWithDiscardedDiffs(): CompositeBlockchain = { def bc = CompositeBlockchain(blockchain, utxPool.discardedMicrosDiff()) @@ -230,12 +231,15 @@ case class Domain( def appendBlockE(txs: Transaction*): Either[ValidationError, Seq[Diff]] = appendBlockE(createBlock(Block.PlainBlockVersion, txs)) - def appendBlock(txs: Transaction*): Block = { - val block = createBlock(Block.PlainBlockVersion, txs) + def appendBlock(version: Byte, txs: Transaction*): Block = { + val block = createBlock(version, txs) appendBlock(block) lastBlock } + def appendBlock(txs: Transaction*): Block = + appendBlock(Block.PlainBlockVersion, txs: _*) + def appendKeyBlock(ref: Option[ByteStr] = None): Block = { val block = createBlock(Block.NgBlockVersion, Nil, ref.orElse(Some(lastBlockId))) val discardedDiffs = appendBlock(block) @@ -247,7 +251,7 @@ case class Domain( def appendMicroBlockE(txs: Transaction*): Either[Throwable, BlockId] = Try(appendMicroBlock(txs*)).toEither - def appendMicroBlock(txs: Transaction*): BlockId = { + def createMicroBlock(txs: Transaction*): MicroBlock = { val lastBlock = this.lastBlock val block = Block .buildAndSign( @@ -262,7 +266,11 @@ case class Domain( lastBlock.header.rewardVote ) .explicitGet() - val mb = MicroBlock.buildAndSign(lastBlock.header.version, defaultSigner, txs, blockchainUpdater.lastBlockId.get, block.signature).explicitGet() + MicroBlock.buildAndSign(lastBlock.header.version, defaultSigner, txs, blockchainUpdater.lastBlockId.get, block.signature).explicitGet() + } + + def appendMicroBlock(txs: Transaction*): BlockId = { + val mb = createMicroBlock(txs: _*) blockchainUpdater.processMicroBlock(mb).explicitGet() } @@ -416,8 +424,16 @@ case class Domain( } object Domain { - implicit class BlockchainUpdaterExt[A <: BlockchainUpdater](bcu: A) { - def processBlock(block: Block): Either[ValidationError, Seq[Diff]] = - bcu.processBlock(block, block.header.generationSignature) + implicit class BlockchainUpdaterExt[A <: BlockchainUpdater with Blockchain](bcu: A) { + def processBlock(block: Block): Either[ValidationError, Seq[Diff]] = { + val hitSource = + if (bcu.height == 0 || !bcu.activatedFeaturesAt(bcu.height + 1).contains(BlockV5.id)) + block.header.generationSignature + else { + val hs = bcu.hitSource(bcu.height).get + crypto.verifyVRF(block.header.generationSignature, hs.arr, block.header.generator, bcu.isFeatureActivated(RideV6)).explicitGet() + } + bcu.processBlock(block, hitSource) + } } } diff --git a/node/src/test/scala/com/wavesplatform/mining/BlockV5Test.scala b/node/src/test/scala/com/wavesplatform/mining/BlockV5Test.scala index 9cbb75e1f7c..ac34037f782 100644 --- a/node/src/test/scala/com/wavesplatform/mining/BlockV5Test.scala +++ b/node/src/test/scala/com/wavesplatform/mining/BlockV5Test.scala @@ -1,7 +1,5 @@ package com.wavesplatform.mining -import java.util.concurrent.atomic.AtomicReference - import com.typesafe.config.ConfigFactory import com.wavesplatform.account.{AddressOrAlias, KeyPair} import com.wavesplatform.block.serialization.{BlockHeaderSerializer, BlockSerializer} @@ -36,12 +34,13 @@ import org.scalacheck.Gen import org.scalatest.* import org.scalatest.enablers.Length +import java.util.concurrent.atomic.AtomicReference import scala.concurrent.Await import scala.concurrent.duration.* class BlockV5Test extends FlatSpec with WithDomain with OptionValues with EitherValues with BlocksTransactionsHelpers { import BlockV5Test.* - private val testTime = new TestTime(1) + private val testTime = TestTime(1) def shiftTime(miner: MinerImpl, minerAcc: KeyPair): Unit = { val offset = miner.getNextBlockGenerationOffset(minerAcc).explicitGet() testTime.advance(offset + 1.milli) @@ -392,14 +391,8 @@ class BlockV5Test extends FlatSpec with WithDomain with OptionValues with Either d => def applyBlock(txs: Transaction*): SignedBlockHeader = { d.appendBlock( - TestBlock.create( - System.currentTimeMillis(), - d.blockchainUpdater.lastBlockId.getOrElse(TestBlock.randomSignature()), - txs, - version = - if (d.blockchainUpdater.height >= 1) Block.ProtoBlockVersion - else Block.PlainBlockVersion - ) + if (d.blockchainUpdater.height >= 1) Block.ProtoBlockVersion else Block.PlainBlockVersion, + txs: _* ) lastBlock } @@ -419,19 +412,11 @@ class BlockV5Test extends FlatSpec with WithDomain with OptionValues with Either block3.header.reference shouldBe block2.id() block3.id() should have length crypto.DigestLength - val (keyBlock, microBlocks) = - UnsafeBlocks.unsafeChainBaseAndMicro( - block3.id(), - Nil, - Seq(Seq(TxHelpers.transfer()), Seq(TxHelpers.transfer())), - acc, - Block.ProtoBlockVersion, - System.currentTimeMillis() - ) - d.appendBlock(keyBlock) - microBlocks.foreach(d.appendMicroBlock) + val keyBlock = d.appendKeyBlock() + val mb1 = d.createMicroBlock(TxHelpers.transfer()) + d.blockchain.processMicroBlock(mb1) + d.appendMicroBlock(TxHelpers.transfer()) - val mb1 = d.microBlocks.head mb1.totalResBlockSig should have length crypto.SignatureLength mb1.reference should not be keyBlock.signature mb1.reference shouldBe keyBlock.id() diff --git a/node/src/test/scala/com/wavesplatform/state/BlockchainUpdaterImplSpec.scala b/node/src/test/scala/com/wavesplatform/state/BlockchainUpdaterImplSpec.scala index 754647c48da..1ec799696a6 100644 --- a/node/src/test/scala/com/wavesplatform/state/BlockchainUpdaterImplSpec.scala +++ b/node/src/test/scala/com/wavesplatform/state/BlockchainUpdaterImplSpec.scala @@ -5,13 +5,14 @@ import com.typesafe.config.ConfigFactory import com.wavesplatform.TestHelpers.enableNG import com.wavesplatform.account.{Address, KeyPair} import com.wavesplatform.block.Block +import com.wavesplatform.block.Block.PlainBlockVersion import com.wavesplatform.common.utils.EitherExt2 import com.wavesplatform.database.loadActiveLeases import com.wavesplatform.db.WithState.AddrWithBalance import com.wavesplatform.db.{DBCacheSettings, WithDomain} import com.wavesplatform.events.BlockchainUpdateTriggers import com.wavesplatform.history.Domain.BlockchainUpdaterExt -import com.wavesplatform.history.{chainBaseAndMicro, randomSig} +import com.wavesplatform.history.{Domain, chainBaseAndMicro, randomSig} import com.wavesplatform.lagonaki.mocks.TestBlock import com.wavesplatform.lang.v1.estimator.v2.ScriptEstimatorV2 import com.wavesplatform.settings.{WavesSettings, loadConfig} @@ -313,9 +314,9 @@ class BlockchainUpdaterImplSpec extends FreeSpec with EitherMatchers with WithDo loadActiveLeases(db, _, _) ) - val block = TestBlock.create(Seq(genesis(defaultAddress))) - blockchain.processBlock(block) - blockchain.processBlock(TestBlock.create(block.header.timestamp, block.id(), Seq(transfer()))) + val d = Domain(db, blockchain, levelDb, RideV6) + blockchain.processBlock(d.createBlock(PlainBlockVersion, Seq(genesis(defaultAddress)), generator = TestBlock.defaultSigner)) + blockchain.processBlock(d.createBlock(PlainBlockVersion, Seq(transfer()), generator = TestBlock.defaultSigner)) ps.onComplete() Await.result(items, 2.seconds) shouldBe Seq( diff --git a/node/src/test/scala/com/wavesplatform/state/RollbackSpec.scala b/node/src/test/scala/com/wavesplatform/state/RollbackSpec.scala index 44b906eded4..d5bc1315dfc 100644 --- a/node/src/test/scala/com/wavesplatform/state/RollbackSpec.scala +++ b/node/src/test/scala/com/wavesplatform/state/RollbackSpec.scala @@ -484,13 +484,7 @@ class RollbackSpec extends FreeSpec with WithDomain { TxHelpers.invoke(dApp.toAddress, func = Some(fc.function.funcName), args = fc.args, invoker = invoker, fee = fee) )(setScript => diffs.ci.toInvokeExpression(setScript, invoker, Some(fee), Some(fc))) - d.appendBlock( - TestBlock.create( - nextTs, - parentBlockId, - Seq(invoke) - ) - ) + d.appendBlock(invoke) invoke.id() } @@ -503,7 +497,7 @@ class RollbackSpec extends FreeSpec with WithDomain { val (setScriptToConvert, checkAddress) = if (useInvokeExpression) (Some(setScript), invoker.toAddress) else (None, dApp.toAddress) val append = appendBlock(d, invoker, dApp, setScriptToConvert) _ - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq(setScript))) + d.appendBlock(setScript) val startBlockId = d.lastBlockId @@ -520,7 +514,7 @@ class RollbackSpec extends FreeSpec with WithDomain { // hardened block rollback val issueTxId = append(startBlockId, issueFc) val asset = getAsset(d, issueTxId) - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() d.balance(checkAddress, asset) shouldBe quantity d.blockchainUpdater.removeAfter(startBlockId).explicitGet() d.balance(checkAddress, asset) shouldBe 0L @@ -538,7 +532,7 @@ class RollbackSpec extends FreeSpec with WithDomain { val (setScriptToConvert, checkAddress) = if (useInvokeExpression) (Some(setScript), invoker.toAddress) else (None, dApp.toAddress) val append = appendBlock(d, invoker, dApp, setScriptToConvert) _ - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq(setScript))) + d.appendBlock(setScript) val startBlockId = d.lastBlockId @@ -546,7 +540,7 @@ class RollbackSpec extends FreeSpec with WithDomain { val issueTxId = append(startBlockId, issueFc) val asset = getAsset(d, issueTxId) - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() val issueBlockId = d.lastBlockId val issueDescription = d.blockchainUpdater.assetDescription(asset) @@ -563,7 +557,7 @@ class RollbackSpec extends FreeSpec with WithDomain { // hardened block rollback append(issueBlockId, reissueFc) d.balance(checkAddress, asset) shouldBe reissued + quantity - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() d.blockchainUpdater.removeAfter(issueBlockId).explicitGet() d.balance(checkAddress, asset) shouldBe quantity d.blockchainUpdater.assetDescription(asset) shouldBe issueDescription @@ -579,7 +573,7 @@ class RollbackSpec extends FreeSpec with WithDomain { ) { d => val (setScriptToConvert, checkAddress) = if (useInvokeExpression) (Some(setScript), invoker.toAddress) else (None, dApp.toAddress) val append = appendBlock(d, invoker, dApp, setScriptToConvert) _ - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq(setScript))) + d.appendBlock(setScript) val startBlockId = d.lastBlockId @@ -587,7 +581,7 @@ class RollbackSpec extends FreeSpec with WithDomain { val issueTxId = append(startBlockId, issueFc) val asset = getAsset(d, issueTxId) - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() val issueBlockId = d.lastBlockId val issueDescription = d.blockchainUpdater.assetDescription(asset) @@ -604,7 +598,7 @@ class RollbackSpec extends FreeSpec with WithDomain { // hardened block rollback append(issueBlockId, burntFc) d.balance(checkAddress, asset) shouldBe quantity - burnt - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() d.blockchainUpdater.removeAfter(issueBlockId).explicitGet() d.balance(checkAddress, asset) shouldBe quantity d.blockchainUpdater.assetDescription(asset) shouldBe issueDescription @@ -621,7 +615,7 @@ class RollbackSpec extends FreeSpec with WithDomain { val setScriptToConvert = if (useInvokeExpression) Some(setScript) else None val append = appendBlock(d, invoker, dApp, setScriptToConvert) _ - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq(setScript))) + d.appendBlock(setScript) val startBlockId = d.lastBlockId @@ -629,7 +623,7 @@ class RollbackSpec extends FreeSpec with WithDomain { val issueTxId = append(startBlockId, issueFc) val asset = getAsset(d, issueTxId) - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() val issueBlockId = d.lastBlockId val issueDescription = d.blockchainUpdater.assetDescription(asset) @@ -645,7 +639,7 @@ class RollbackSpec extends FreeSpec with WithDomain { // hardened block rollback append(issueBlockId, sponsorFc) d.blockchainUpdater.assetDescription(asset).get.sponsorship shouldBe sponsorship - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq())) + d.appendBlock() d.blockchainUpdater.removeAfter(issueBlockId).explicitGet() d.blockchainUpdater.assetDescription(asset).get.sponsorship shouldBe 0L d.blockchainUpdater.assetDescription(asset) shouldBe issueDescription @@ -663,7 +657,7 @@ class RollbackSpec extends FreeSpec with WithDomain { if (useInvokeExpression) (Some(setScript), invoker.toAddress, invoker.publicKey) else (None, dApp.toAddress, dApp.publicKey) val append = appendBlock(d, invoker, dApp, setScriptToConvert) _ - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq(setScript))) + d.appendBlock(setScript) val beforeInvoke1 = d.lastBlockId val (leaseAmount, leaseFc) = leaseFunctionCall(leaseRecipientAddress.toAddress) @@ -804,10 +798,12 @@ class RollbackSpec extends FreeSpec with WithDomain { val leaseAmount = smallFeeGen.sample.get val leaseTx = - LeaseTransaction.selfSigned(2.toByte, leaseSender, leaseRecipientAddress.toAddress, leaseAmount, setScript.fee.value, nextTs).explicitGet() + LeaseTransaction + .selfSigned(2.toByte, leaseSender, leaseRecipientAddress.toAddress, leaseAmount, setScript.fee.value, nextTs) + .explicitGet() val leaseId = leaseTx.id() - d.appendBlock(TestBlock.create(nextTs, d.lastBlockId, Seq(setScript, leaseTx))) + d.appendBlock(setScript, leaseTx) assertLeaseCancel( dApp, diff --git a/node/src/test/scala/com/wavesplatform/state/diffs/AssetTransactionsDiffTest.scala b/node/src/test/scala/com/wavesplatform/state/diffs/AssetTransactionsDiffTest.scala index ef22877b426..8df85588cd6 100644 --- a/node/src/test/scala/com/wavesplatform/state/diffs/AssetTransactionsDiffTest.scala +++ b/node/src/test/scala/com/wavesplatform/state/diffs/AssetTransactionsDiffTest.scala @@ -333,23 +333,14 @@ class AssetTransactionsDiffTest extends PropSpec with BlocksTransactionsHelpers } property(s"Can update with CompositeBlockchain") { - val (gen, issues, signer, update1) = genesisIssueUpdateWithSecondAsset + val (gen, issues, _, update1) = genesisIssueUpdateWithSecondAsset withDomain(domainSettingsWithFS(assetInfoUpdateEnabled.copy(minAssetInfoUpdateInterval = 0))) { d => val blockchain = d.blockchainUpdater val genesisBlock = TestBlock.create(gen ++ issues) d.appendBlock(genesisBlock) - val (keyBlock, mbs) = - UnsafeBlocks.unsafeChainBaseAndMicro( - genesisBlock.id(), - Nil, - Seq(Seq(update1)), - signer, - Block.ProtoBlockVersion, - genesisBlock.header.timestamp + 100 - ) - d.appendBlock(keyBlock) - val microBlockId = d.appendMicroBlock(mbs.head) + d.appendBlock() + d.appendMicroBlock(update1) val issue = issues(0) val issue1 = issues(1) @@ -367,9 +358,7 @@ class AssetTransactionsDiffTest extends PropSpec with BlocksTransactionsHelpers desc1.lastUpdatedAt shouldBe blockchain.height } - val (keyBlock1, _) = - UnsafeBlocks.unsafeChainBaseAndMicro(microBlockId, Nil, Nil, signer, Block.ProtoBlockVersion, keyBlock.header.timestamp + 100) - d.appendBlock(keyBlock1) + d.appendKeyBlock() { // Check after new key block val desc = blockchain.assetDescription(issue.asset).get diff --git a/node/src/test/scala/com/wavesplatform/transaction/BlockchainUpdaterTest.scala b/node/src/test/scala/com/wavesplatform/transaction/BlockchainUpdaterTest.scala index 91ed316c1fa..dcd4e0db44b 100644 --- a/node/src/test/scala/com/wavesplatform/transaction/BlockchainUpdaterTest.scala +++ b/node/src/test/scala/com/wavesplatform/transaction/BlockchainUpdaterTest.scala @@ -1,17 +1,17 @@ package com.wavesplatform.transaction -import java.security.Permission -import java.util.concurrent.{Semaphore, TimeUnit} - import com.wavesplatform.block.Block import com.wavesplatform.common.utils.EitherExt2 import com.wavesplatform.db.WithDomain import com.wavesplatform.features.BlockchainFeatureStatus -import com.wavesplatform.history.Domain.BlockchainUpdaterExt -import com.wavesplatform.state._ import com.wavesplatform.history +import com.wavesplatform.history.Domain.BlockchainUpdaterExt +import com.wavesplatform.state.* +import com.wavesplatform.test.DomainPresets.RideV6 import com.wavesplatform.test.FreeSpec +import java.security.Permission +import java.util.concurrent.{Semaphore, TimeUnit} import scala.util.Try class BlockchainUpdaterTest extends FreeSpec with HistoryTest with WithDomain { @@ -20,18 +20,20 @@ class BlockchainUpdaterTest extends FreeSpec with HistoryTest with WithDomain { private val WavesSettings = history.DefaultWavesSettings.copy( blockchainSettings = history.DefaultWavesSettings.blockchainSettings.copy( - functionalitySettings = history.DefaultWavesSettings.blockchainSettings.functionalitySettings.copy(featureCheckBlocksPeriod = ApprovalPeriod, blocksForFeatureActivation = (ApprovalPeriod * 0.9).toInt, preActivatedFeatures = Map.empty) + functionalitySettings = history.DefaultWavesSettings.blockchainSettings.functionalitySettings + .copy(featureCheckBlocksPeriod = ApprovalPeriod, blocksForFeatureActivation = (ApprovalPeriod * 0.9).toInt, preActivatedFeatures = Map.empty) ), featuresSettings = history.DefaultWavesSettings.featuresSettings.copy(autoShutdownOnUnsupportedFeature = true) ) private val WavesSettingsWithDoubling = WavesSettings.copy( blockchainSettings = WavesSettings.blockchainSettings.copy( - functionalitySettings = WavesSettings.blockchainSettings.functionalitySettings.copy(preActivatedFeatures = Map.empty, doubleFeaturesPeriodsAfterHeight = 300) + functionalitySettings = + WavesSettings.blockchainSettings.functionalitySettings.copy(preActivatedFeatures = Map.empty, doubleFeaturesPeriodsAfterHeight = 300) ) ) - def appendBlock(block: Block, blockchainUpdater: BlockchainUpdater): Unit = { + def appendBlock(block: Block, blockchainUpdater: BlockchainUpdater with Blockchain): Unit = { blockchainUpdater.processBlock(block) } @@ -219,8 +221,7 @@ class BlockchainUpdaterTest extends FreeSpec with HistoryTest with WithDomain { b.processBlock(getNextTestBlockWithVotes(b, Seq(-1))) should beRight } - Try(b.processBlock(getNextTestBlockWithVotes(b, Seq(-1)))).recover { - case _: SecurityException => // NOP + Try(b.processBlock(getNextTestBlockWithVotes(b, Seq(-1)))).recover { case _: SecurityException => // NOP } signal.tryAcquire(10, TimeUnit.SECONDS) @@ -350,4 +351,13 @@ class BlockchainUpdaterTest extends FreeSpec with HistoryTest with WithDomain { b.processBlock(getNextTestBlockWithVotes(b, Seq())) should beRight b.featureStatus(2, b.height) should be(BlockchainFeatureStatus.Activated) } + + "correct calculate hit source in tests" in + withDomain(RideV6) { d => + d.appendBlock() + d.appendBlock() + d.appendBlock() + d.rollbackTo(2) + d.appendBlock() + } } diff --git a/node/src/test/scala/com/wavesplatform/utx/UtxFailedTxsSpec.scala b/node/src/test/scala/com/wavesplatform/utx/UtxFailedTxsSpec.scala index 7ecdf94a829..fa4b4813c26 100644 --- a/node/src/test/scala/com/wavesplatform/utx/UtxFailedTxsSpec.scala +++ b/node/src/test/scala/com/wavesplatform/utx/UtxFailedTxsSpec.scala @@ -36,7 +36,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.putIfNew(tx, forceValidate = false).resultE should produce("reached err") utx.putIfNew(tx, forceValidate = true).resultE should produce("reached err") - utx.addAndCleanup(Seq(tx)) + utx.addAndScheduleCleanup(Seq(tx)) eventually { utx.size shouldBe 0 } @@ -50,7 +50,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.putIfNew(tx, forceValidate = true).resultE should produce("reached err") utx.putIfNew(tx, forceValidate = false).resultE shouldBe Right(true) - utx.addAndCleanup(Nil) + utx.addAndScheduleCleanup(Nil) Thread.sleep(5000) utx.size shouldBe 1 @@ -107,7 +107,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.putIfNew(tx, forceValidate = true).resultE should produce(s"Transfer error: asset '${TestValues.asset}' is not found on the blockchain") utx.putIfNew(tx, forceValidate = false).resultE shouldBe Right(true) - utx.addAndCleanup(Nil) + utx.addAndScheduleCleanup(Nil) Thread.sleep(5000) utx.size shouldBe 1 @@ -147,7 +147,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.putIfNew(tx, forceValidate = true).resultE should produce("reached err") utx.putIfNew(tx, forceValidate = false).resultE shouldBe Right(true) - utx.addAndCleanup(Nil) + utx.addAndScheduleCleanup(Nil) Thread.sleep(5000) utx.size shouldBe 1 @@ -165,7 +165,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.putIfNew(tx, forceValidate = false).resultE should produce("reached err") utx.putIfNew(tx, forceValidate = true).resultE should produce("reached err") - utx.addAndCleanup(Seq(tx)) + utx.addAndScheduleCleanup(Seq(tx)) eventually { utx.size shouldBe 0 } @@ -185,7 +185,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.putIfNew(tx, forceValidate = true).resultE should produce("reached err") utx.putIfNew(tx, forceValidate = false).resultE shouldBe Right(true) - utx.addAndCleanup(Nil) + utx.addAndScheduleCleanup(Nil) Thread.sleep(5000) utx.size shouldBe 1 @@ -227,7 +227,7 @@ class UtxFailedTxsSpec extends FlatSpec with WithDomain with Eventually { utx.size shouldBe 100 d.appendBlock() // Height is odd - utx.addAndCleanup(Nil) + utx.addAndScheduleCleanup(Nil) eventually(timeout(10 seconds), interval(500 millis)) { utx.size shouldBe 0 utx.all shouldBe Nil diff --git a/version.sbt b/version.sbt index 38ff629c332..8d874f1561c 100644 --- a/version.sbt +++ b/version.sbt @@ -1 +1 @@ -git.baseVersion := "1.4.10" +git.baseVersion := "1.4.11"