Skip to content

Commit

Permalink
Merge pull request #680 from ScorexFoundation/cost-vectors
Browse files Browse the repository at this point in the history
Test vectors for cost estimation
  • Loading branch information
aslesarenko authored Sep 22, 2020
2 parents 8908614 + c125fb4 commit 75d2a9a
Show file tree
Hide file tree
Showing 47 changed files with 2,469 additions and 1,731 deletions.
20 changes: 5 additions & 15 deletions sigmastate/src/main/scala/org/ergoplatform/ErgoBox.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package org.ergoplatform

import com.google.common.primitives.Shorts
import org.ergoplatform.ErgoBox.{NonMandatoryRegisterId, TokenId}
import org.ergoplatform.ErgoBox.{TokenId, NonMandatoryRegisterId}
import org.ergoplatform.settings.ErgoAlgos
import scorex.crypto.authds.ADKey
import scorex.crypto.hash.{Blake2b256, Digest32}
import scorex.crypto.hash.{Digest32, Blake2b256}
import scorex.util._
import sigmastate.SCollection.SByteArray
import sigmastate.SType.AnyOps
Expand All @@ -13,7 +13,7 @@ import sigmastate._
import sigmastate.eval.Extensions._
import sigmastate.eval._
import sigmastate.serialization.SigmaSerializer
import sigmastate.utils.{Helpers, SigmaByteReader, SigmaByteWriter}
import sigmastate.utils.{SigmaByteReader, SigmaByteWriter, Helpers}
import sigmastate.utxo.ExtractCreationInfo
import special.collection._

Expand Down Expand Up @@ -127,6 +127,8 @@ object ErgoBox {
abstract class MandatoryRegisterId(override val number: Byte, val purpose: String) extends RegisterId
abstract class NonMandatoryRegisterId(override val number: Byte) extends RegisterId

type AdditionalRegisters = Map[NonMandatoryRegisterId, _ <: EvaluatedValue[_ <: SType]]

object R0 extends MandatoryRegisterId(0, "Monetary value, in Ergo tokens")
object R1 extends MandatoryRegisterId(1, "Guarding script")
object R2 extends MandatoryRegisterId(2, "Secondary tokens")
Expand Down Expand Up @@ -175,18 +177,6 @@ object ErgoBox {

val allZerosModifierId: ModifierId = Array.fill[Byte](32)(0.toByte).toModifierId

def apply(value: Long,
ergoTree: ErgoTree,
creationHeight: Int,
additionalTokens: Seq[(TokenId, Long)] = Nil,
additionalRegisters: Map[NonMandatoryRegisterId, _ <: EvaluatedValue[_ <: SType]] = Map.empty,
transactionId: ModifierId = allZerosModifierId,
boxIndex: Short = 0): ErgoBox =
new ErgoBox(value, ergoTree,
Colls.fromArray(additionalTokens.toArray[(TokenId, Long)]),
additionalRegisters,
transactionId, boxIndex, creationHeight)

object sigmaSerializer extends SigmaSerializer[ErgoBox, ErgoBox] {

override def serialize(obj: ErgoBox, w: SigmaByteWriter): Unit = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scorex.crypto.authds.avltree.batch._
import scorex.crypto.authds.{ADDigest, ADKey, SerializedAdProof, ADValue}
import sigmastate.SCollection.SByteArray
import sigmastate.{TrivialProp, _}
import sigmastate.Values.{Constant, EvaluatedValue, SValue, ConstantNode, Value, ErgoTree, SigmaBoolean}
import sigmastate.Values.{Constant, EvaluatedValue, SValue, ConstantNode, ErgoTree, SigmaBoolean}
import sigmastate.interpreter.CryptoConstants.EcPointType
import sigmastate.interpreter.{CryptoConstants, Interpreter}
import special.collection.{Size, CSizeOption, SizeColl, CCostedBuilder, CollType, SizeOption, CostedBuilder, Coll}
Expand Down Expand Up @@ -738,4 +738,33 @@ case class CostingDataContext(
} else None
}
}

/** Return a new context instance with variables collection updated.
* @param bindings a new binding of the context variables with new values.
* @return a new instance (if `bindings` non-empty) with the specified bindings.
* other existing bindings are copied to the new instance
*/
def withUpdatedVars(bindings: (Int, AnyValue)*): CostingDataContext = {
if (bindings.isEmpty) return this

val ids = bindings.map(_._1).toArray
val values = bindings.map(_._2).toArray
val maxVarId = ids.max // INV: ids is not empty
val requiredNewLength = maxVarId + 1

val newVars = if (vars.length < requiredNewLength) {
// grow vars collection
val currVars = vars.toArray
val buf = new Array[AnyValue](requiredNewLength)
Array.copy(currVars, 0, buf, 0, currVars.length)
cfor(0)(_ < ids.length, _ + 1) { i =>
buf(ids(i)) = values(i)
}
buf.toColl
} else {
vars.updateMany(ids.toColl, values.toColl)
}

this.copy(vars = newVars)
}
}
2 changes: 1 addition & 1 deletion sigmastate/src/main/scala/sigmastate/eval/IRContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ trait IRContext extends Evaluation with TreeBuilding {
* And taking into account the cleaning of the garbage and cutting the blockchain history,
* the old scripts at some point will die out of the blockchain.
*/
def checkCostWithContext(ctx: SContext, exp: Value[SType],
def checkCostWithContext(ctx: SContext,
costF: Ref[((Context, (Int, Size[Context]))) => Int], maxCost: Long, initCost: Long): Try[Int] = Try {
val costFun = compile[(SContext, (Int, SSize[SContext])), Int, (Context, (Int, Size[Context])), Int](
getDataEnv, costF, Some(maxCost))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ trait Interpreter extends ScorexLogging {
CheckCostFunc(IR)(asRep[Any => Int](costF))

val costingCtx = context.toSigmaContext(IR, isCost = true)
val estimatedCost = IR.checkCostWithContext(costingCtx, exp, costF, maxCost, initCost).getOrThrow
val estimatedCost = IR.checkCostWithContext(costingCtx, costF, maxCost, initCost).getOrThrow

IR.onEstimatedCost(env, exp, costingRes, costingCtx, estimatedCost)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import sigmastate.{SigmaAnd, SType}
import sigmastate.Values.{UnparsedErgoTree, Constant, ByteArrayConstant, IntConstant, ErgoTree}
import sigmastate.eval.IRContext
import sigmastate.helpers._
import sigmastate.helpers.TestingHelpers._
import sigmastate.interpreter.ContextExtension
import sigmastate.interpreter.Interpreter.{ScriptNameProp, ScriptEnv}
import sigmastate.lang.Terms.ValueOps
Expand Down Expand Up @@ -182,7 +183,7 @@ class ErgoAddressSpecification extends SigmaDslTesting with TryValues {

def testPay2SHAddress(address: Pay2SHAddress, scriptBytes: Array[Byte])(implicit IR: IRContext) = {
val scriptId = 1.toByte
val boxToSpend = ErgoBox(10, address.script, creationHeight = 5)
val boxToSpend = testBox(10, address.script, creationHeight = 5)
val ctx = ErgoLikeContextTesting.dummy(boxToSpend)
.withExtension(ContextExtension(Seq(
scriptId -> ByteArrayConstant(scriptBytes) // provide script bytes in context variable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@ import org.ergoplatform.ErgoBox.R4
import org.ergoplatform.mining.emission.EmissionRules
import org.ergoplatform.settings.MonetarySettings
import org.scalacheck.Gen
import scorex.crypto.hash.{Blake2b256, Digest32}
import scorex.crypto.hash.{Digest32, Blake2b256}
import scorex.util.Random
import sigmastate.Values.{ByteArrayConstant, CollectionConstant, ErgoTree, IntConstant, SigmaPropConstant}
import sigmastate.Values.{SigmaPropConstant, CollectionConstant, ByteArrayConstant, IntConstant, ErgoTree}
import sigmastate._
import sigmastate.basics.DLogProtocol.{DLogProverInput, ProveDlog}
import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, SigmaTestingCommons}
import sigmastate.basics.DLogProtocol.{ProveDlog, DLogProverInput}
import sigmastate.helpers.{ErgoLikeContextTesting, ErgoLikeTestInterpreter, SigmaTestingCommons, ContextEnrichingTestProvingInterpreter}
import sigmastate.helpers.TestingHelpers._
import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv}
import sigmastate.interpreter.{ContextExtension, ProverResult}
import sigmastate.interpreter.{ProverResult, ContextExtension}
import sigmastate.lang.Terms.ValueOps
import sigmastate.serialization.ValueSerializer
import sigmastate.utxo.{ByIndex, CostTable, ExtractCreationInfo, SelectField}
import sigmastate.utxo.{CostTable, ExtractCreationInfo, ByIndex, SelectField}
import scalan.util.BenchmarkUtil._
import ErgoScriptPredef._
import sigmastate.utils.Helpers._
Expand All @@ -42,7 +43,7 @@ class ErgoScriptPredefSpec extends SigmaTestingCommons {
val prop = EQ(Height, ErgoScriptPredef.boxCreationHeight(ByIndex(Outputs, IntConstant(0)))).toSigmaProp
val propInlined = EQ(Height, SelectField(ExtractCreationInfo(ByIndex(Outputs, IntConstant(0))), 1).asIntValue).toSigmaProp
prop shouldBe propInlined
val inputBox = ErgoBox(1, prop, nextHeight, Seq(), Map())
val inputBox = testBox(1, prop, nextHeight, Seq(), Map())
val inputBoxes = IndexedSeq(inputBox)
val inputs = inputBoxes.map(b => Input(b.id, emptyProverResult))
val minerBox = new ErgoBoxCandidate(1, SigmaPropConstant(minerProp), nextHeight)
Expand Down Expand Up @@ -102,10 +103,10 @@ class ErgoScriptPredefSpec extends SigmaTestingCommons {
newProp: ErgoTree,
inputR4Val: CollectionConstant[SByte.type]): Try[Unit] = Try {
val outputR4Val: CollectionConstant[SByte.type] = ByteArrayConstant(Random.randomBytes())
val inputBoxes = IndexedSeq(ErgoBox(emission.foundersCoinsTotal, prop, 0, Seq(), Map(R4 -> inputR4Val)))
val inputBoxes = IndexedSeq(testBox(emission.foundersCoinsTotal, prop, 0, Seq(), Map(R4 -> inputR4Val)))
val inputs = inputBoxes.map(b => Input(b.id, emptyProverResult))
val newFoundersBox = ErgoBox(remainingAmount, newProp, 0, Seq(), Map(R4 -> outputR4Val))
val collectedBox = ErgoBox(inputBoxes.head.value - remainingAmount, TrueProp, 0)
val newFoundersBox = testBox(remainingAmount, newProp, 0, Seq(), Map(R4 -> outputR4Val))
val collectedBox = testBox(inputBoxes.head.value - remainingAmount, TrueProp, 0)
val spendingTransaction = ErgoLikeTransaction(inputs, IndexedSeq(newFoundersBox, collectedBox))
val ctx = ErgoLikeContextTesting(
currentHeight = height,
Expand All @@ -124,9 +125,9 @@ class ErgoScriptPredefSpec extends SigmaTestingCommons {
val minerPk = prover.dlogSecrets.head.publicImage
val prop = ErgoScriptPredef.rewardOutputScript(settings.minerRewardDelay, minerPk)
val verifier = new ErgoLikeTestInterpreter
val inputBoxes = IndexedSeq(ErgoBox(20, prop, 0, Seq(), Map()))
val inputBoxes = IndexedSeq(testBox(20, prop, 0, Seq(), Map()))
val inputs = inputBoxes.map(b => Input(b.id, emptyProverResult))
val spendingTransaction = ErgoLikeTransaction(inputs, IndexedSeq(ErgoBox(inputBoxes.head.value, TrueProp, 0)))
val spendingTransaction = ErgoLikeTransaction(inputs, IndexedSeq(testBox(inputBoxes.head.value, TrueProp, 0)))

val ctx = ErgoLikeContextTesting(
currentHeight = inputBoxes.head.creationHeight + settings.minerRewardDelay,
Expand Down Expand Up @@ -157,7 +158,7 @@ class ErgoScriptPredefSpec extends SigmaTestingCommons {
val prover = new ContextEnrichingTestProvingInterpreter
val minerPk = prover.dlogSecrets.head.publicImage
val prop = ErgoScriptPredef.emissionBoxProp(settings)
val emissionBox = ErgoBox(emission.coinsTotal, prop, 0, Seq(), Map())
val emissionBox = testBox(emission.coinsTotal, prop, 0, Seq(), Map())
val minerProp = ErgoScriptPredef.rewardOutputScript(settings.minerRewardDelay, minerPk)

// collect coins during the fixed rate period
Expand Down Expand Up @@ -215,7 +216,7 @@ class ErgoScriptPredefSpec extends SigmaTestingCommons {
def check(inputBoxes: IndexedSeq[ErgoBox]): Try[Unit] = Try {
val inputs = inputBoxes.map(b => Input(b.id, emptyProverResult))
val amount = inputBoxes.map(_.value).sum
val spendingTransaction = ErgoLikeTransaction(inputs, IndexedSeq(ErgoBox(amount, pubkey.toSigmaProp, 0)))
val spendingTransaction = ErgoLikeTransaction(inputs, IndexedSeq(testBox(amount, pubkey.toSigmaProp, 0)))

val ctx = ErgoLikeContextTesting(
currentHeight = 50,
Expand All @@ -233,37 +234,37 @@ class ErgoScriptPredefSpec extends SigmaTestingCommons {
measure(10) { i =>
// transaction with the only input with enough token should pass
val inputs0 = IndexedSeq(
ErgoBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount), (wrongId2, tokenAmount)), Map())
testBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount), (wrongId2, tokenAmount)), Map())
)
check(inputs0).get shouldBe (())

// transaction with the only input with insufficient token should fail
val inputs1 = IndexedSeq(
ErgoBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount - 1)), Map())
testBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount - 1)), Map())
)
check(inputs1) shouldBe 'failure

// transaction with multiple inputs with insufficient token should fail
val inputs2 = IndexedSeq(
ErgoBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount - 2)), Map()),
ErgoBox(20, prop, 0, Seq((wrongId, tokenAmount)), Map()),
ErgoBox(20, prop, 0, Seq((tokenId, 1), (wrongId2, tokenAmount)), Map())
testBox(20, prop, 0, Seq((wrongId, tokenAmount), (tokenId, tokenAmount - 2)), Map()),
testBox(20, prop, 0, Seq((wrongId, tokenAmount)), Map()),
testBox(20, prop, 0, Seq((tokenId, 1), (wrongId2, tokenAmount)), Map())
)
check(inputs2) shouldBe 'failure

// transaction with multiple inputs with enough token should pass
val inputs3 = IndexedSeq(
ErgoBox(20, prop, 0, Seq((wrongId, 1), (tokenId, tokenAmount / 2)), Map()),
ErgoBox(20, prop, 0, Seq((wrongId, 1)), Map()),
ErgoBox(20, prop, 0, Seq((tokenId, tokenAmount / 2 + 1), (wrongId2, 1)), Map())
testBox(20, prop, 0, Seq((wrongId, 1), (tokenId, tokenAmount / 2)), Map()),
testBox(20, prop, 0, Seq((wrongId, 1)), Map()),
testBox(20, prop, 0, Seq((tokenId, tokenAmount / 2 + 1), (wrongId2, 1)), Map())
)
check(inputs3).getOrThrow

// A transaction which contains input with no tokens
val inputs4 = IndexedSeq(
ErgoBox(20, prop, 0, Seq((wrongId, 1), (tokenId, tokenAmount / 2)), Map()),
ErgoBox(20, prop, 0, Seq(), Map()),
ErgoBox(20, prop, 0, Seq((tokenId, tokenAmount / 2 + 1), (wrongId2, 1)), Map())
testBox(20, prop, 0, Seq((wrongId, 1), (tokenId, tokenAmount / 2)), Map()),
testBox(20, prop, 0, Seq(), Map()),
testBox(20, prop, 0, Seq((tokenId, tokenAmount / 2 + 1), (wrongId2, 1)), Map())
)
check(inputs4) shouldBe 'success
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@ package org.ergoplatform.dsl
import sigmastate.interpreter.Interpreter.ScriptNameProp

import scala.collection.mutable
import sigmastate.interpreter.{ContextExtension, CostedProverResult, ProverResult}
import sigmastate.interpreter.{ProverResult, CostedProverResult}

import scala.collection.mutable.ArrayBuffer
import org.ergoplatform.ErgoBox.NonMandatoryRegisterId
import org.ergoplatform.SigmaConstants.ScriptCostLimit
import scalan.Nullable
import scorex.crypto.hash.Digest32

import scala.util.Try
import org.ergoplatform.{ErgoBox, ErgoLikeContext}
import org.ergoplatform.dsl.ContractSyntax.{ErgoScript, Proposition, Token, TokenId}
import org.ergoplatform.validation.ValidationRules
import org.ergoplatform.{ErgoLikeContext, ErgoBox}
import org.ergoplatform.dsl.ContractSyntax.{Token, TokenId, ErgoScript, Proposition}
import sigmastate.{AvlTreeData, SType}
import sigmastate.Values.{ErgoTree, EvaluatedValue}
import sigmastate.eval.{CSigmaProp, Evaluation, IRContext}
import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, SigmaTestingCommons}
import sigmastate.eval.{IRContext, CSigmaProp, Evaluation}
import sigmastate.helpers.{ErgoLikeContextTesting, ErgoLikeTestInterpreter, SigmaTestingCommons, ContextEnrichingTestProvingInterpreter}
import sigmastate.helpers.TestingHelpers._
import sigmastate.lang.Terms.ValueOps
import special.sigma.{AnyValue, SigmaProp, TestValue}
import special.sigma.{AnyValue, TestValue, SigmaProp}

case class TestContractSpec(testSuite: SigmaTestingCommons)(implicit val IR: IRContext) extends ContractSpec {

Expand Down Expand Up @@ -84,7 +83,7 @@ case class TestContractSpec(testSuite: SigmaTestingCommons)(implicit val IR: IRC
minerPubkey = ErgoLikeContextTesting.dummyPubkey,
dataBoxes = dataBoxes,
boxesToSpend = boxesToSpend,
spendingTransaction = testSuite.createTransaction(dataBoxes, tx.outputs.map(_.ergoBox).toIndexedSeq),
spendingTransaction = createTransaction(dataBoxes, tx.outputs.map(_.ergoBox).toIndexedSeq),
selfIndex = boxesToSpend.indexOf(utxoBox.ergoBox) )
ctx
}
Expand Down Expand Up @@ -119,7 +118,7 @@ case class TestContractSpec(testSuite: SigmaTestingCommons)(implicit val IR: IRC

private[dsl] lazy val ergoBox: ErgoBox = {
val tokens = _tokens.map { t => (Digest32 @@ t.id.toArray, t.value) }
ErgoBox(value, propSpec.ergoTree, tx.block.height, tokens, _regs)
testBox(value, propSpec.ergoTree, tx.block.height, tokens, _regs)
}
def id = ergoBox.id
}
Expand Down
13 changes: 7 additions & 6 deletions sigmastate/src/test/scala/sigmastate/CostingSpecification.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ package sigmastate
import org.ergoplatform.SigmaConstants.ScriptCostLimit
import org.ergoplatform.ErgoScriptPredef.TrueProp
import org.ergoplatform.validation.ValidationRules
import org.ergoplatform.{ErgoBox, ErgoLikeContext, ErgoLikeTransaction}
import org.ergoplatform.{ErgoLikeContext, ErgoBox}
import scorex.crypto.authds.avltree.batch.Lookup
import scorex.crypto.authds.{ADDigest, ADKey}
import scorex.crypto.hash.Blake2b256
import sigmastate.Values.{AvlTreeConstant, BigIntConstant, BooleanConstant, ByteArrayConstant, ConstantPlaceholder, ErgoTree, IntConstant, TrueLeaf}
import sigmastate.Values.{TrueLeaf, BigIntConstant, AvlTreeConstant, ConstantPlaceholder, ByteArrayConstant, IntConstant, ErgoTree, BooleanConstant}
import sigmastate.eval.Extensions._
import sigmastate.eval.Sized._
import sigmastate.eval._
import sigmastate.helpers.TestingHelpers._
import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeTestInterpreter}
import sigmastate.interpreter.ContextExtension
import sigmastate.interpreter.Interpreter.{ScriptEnv, ScriptNameProp, emptyEnv}
import sigmastate.interpreter.Interpreter.{ScriptNameProp, ScriptEnv, emptyEnv}
import sigmastate.utxo.CostTable
import sigmastate.utxo.CostTable._
import special.sigma.{AvlTree, SigmaTestingData}
import special.sigma.{SigmaTestingData, AvlTree}

class CostingSpecification extends SigmaTestingData {
implicit lazy val IR = new TestingIRContext {
Expand Down Expand Up @@ -58,8 +59,8 @@ class CostingSpecification extends SigmaTestingData {
Map(ErgoBox.R4 -> ByteArrayConstant(Array[Byte](1, 2, 3)),
ErgoBox.R5 -> IntConstant(3),
ErgoBox.R6 -> AvlTreeConstant(avlTree)))
lazy val outBoxA = ErgoBox(10, pkA, 0)
lazy val outBoxB = ErgoBox(20, pkB, 0)
lazy val outBoxA = testBox(10, pkA, 0)
lazy val outBoxB = testBox(20, pkB, 0)
lazy val tx = createTransaction(IndexedSeq(dataBox), IndexedSeq(outBoxA, outBoxB))
lazy val context =
new ErgoLikeContext(
Expand Down
18 changes: 8 additions & 10 deletions sigmastate/src/test/scala/sigmastate/FailingToProveSpec.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package sigmastate

import org.ergoplatform.{ErgoBox, ErgoLikeContext}
import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeTestInterpreter, SigmaTestingCommons}
import org.ergoplatform.{ErgoBox, ErgoLikeContext, ErgoLikeInterpreter, ErgoLikeTransaction}
import sigmastate.helpers.{ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestInterpreter, SigmaTestingCommons}
import sigmastate.helpers.TestingHelpers._
import sigmastate.lang.Terms._
import org.scalatest.TryValues._
import sigmastate.interpreter.Interpreter.{ScriptNameProp, emptyEnv}
Expand Down Expand Up @@ -34,9 +32,9 @@ class FailingToProveSpec extends SigmaTestingCommons {
| }
""".stripMargin).asBoolValue.toSigmaProp

val selfBox = ErgoBox(200L, compiledScript, 0)
val o1 = ErgoBox(101L, TrueProp, 5001)
val o2 = ErgoBox(99L, TrueProp, 5001)
val selfBox = testBox(200L, compiledScript, 0)
val o1 = testBox(101L, TrueProp, 5001)
val o2 = testBox(99L, TrueProp, 5001)
val tx = createTransaction(IndexedSeq(o1, o2))
val ctx = ErgoLikeContextTesting(
currentHeight = 5001,
Expand Down Expand Up @@ -67,10 +65,10 @@ class FailingToProveSpec extends SigmaTestingCommons {
| }
""".stripMargin).asBoolValue.toSigmaProp

val selfBox = ErgoBox(200L, compiledScript, 0)
val o1 = ErgoBox(102L, TrueProp, 5001)
val o2 = ErgoBox(98L, TrueProp, 5001)
val o3 = ErgoBox(100L, TrueProp, 5001)
val selfBox = testBox(200L, compiledScript, 0)
val o1 = testBox(102L, TrueProp, 5001)
val o2 = testBox(98L, TrueProp, 5001)
val o3 = testBox(100L, TrueProp, 5001)
val tx = createTransaction(IndexedSeq(o1, o2, o3))
val ctx = ErgoLikeContextTesting(
currentHeight = 5001,
Expand Down
Loading

0 comments on commit 75d2a9a

Please sign in to comment.