diff --git a/data/shared/src/main/scala/sigma/ast/methods.scala b/data/shared/src/main/scala/sigma/ast/methods.scala index 25ad4f94c..ed89d1538 100644 --- a/data/shared/src/main/scala/sigma/ast/methods.scala +++ b/data/shared/src/main/scala/sigma/ast/methods.scala @@ -1844,14 +1844,6 @@ case object SContextMethods extends MonoTypeMethods { .withInfo(GetVar, "Get context variable with given \\lst{varId} and type.", ArgInfo("varId", "\\lst{Byte} identifier of context variable")) - lazy val getVarV6Method = SMethod( - this, "getVar", SFunc(ContextFuncDom, SOption(tT), Array(paramT)), 11, GetVar.costKind, Seq(tT)) - .withIRInfo( - MethodCallIrBuilder, - javaMethodOf[Context, Byte, RType[_]]("getVar"), - { mtype => Array(mtype.tRange.asOption[SType].elemType) }) - .withInfo(MethodCall, "Get context variable with given \\lst{varId} and type.") - lazy val getVarFromInputMethod = SMethod( this, "getVarFromInput", SFunc(Array(SContext, SShort, SByte), SOption(tT), Array(paramT)), 12, GetVar.costKind, Seq(tT)) .withIRInfo( @@ -1865,15 +1857,13 @@ case object SContextMethods extends MonoTypeMethods { private lazy val commonMethods = super.getMethods() ++ Array( dataInputsMethod, headersMethod, preHeaderMethod, inputsMethod, outputsMethod, heightMethod, selfMethod, - selfBoxIndexMethod, lastBlockUtxoRootHashMethod, minerPubKeyMethod + selfBoxIndexMethod, lastBlockUtxoRootHashMethod, minerPubKeyMethod, getVarV5Method ) - private lazy val v5Methods = commonMethods ++ Seq( - getVarV5Method - ) + private lazy val v5Methods = commonMethods private lazy val v6Methods = commonMethods ++ Seq( - getVarV6Method, getVarFromInputMethod + getVarFromInputMethod ) protected override def getMethods(): Seq[SMethod] = { diff --git a/sc/shared/src/main/scala/sigma/compiler/ir/GraphBuilding.scala b/sc/shared/src/main/scala/sigma/compiler/ir/GraphBuilding.scala index 7ab784569..70a20d3f1 100644 --- a/sc/shared/src/main/scala/sigma/compiler/ir/GraphBuilding.scala +++ b/sc/shared/src/main/scala/sigma/compiler/ir/GraphBuilding.scala @@ -1082,11 +1082,7 @@ trait GraphBuilding extends Base with DefRewriting { IR: IRContext => ctx.LastBlockUtxoRootHash case SContextMethods.minerPubKeyMethod.name => ctx.minerPubKey - case SContextMethods.getVarV6Method.name => - val c2 = asRep[Byte](argsV(0)) - val c3 = stypeToElem(typeSubst.apply(tT)) - ctx.getVar(c2)(c3) - case SContextMethods.getVarFromInputMethod.name => + case SContextMethods.getVarFromInputMethod.name if VersionContext.current.isV6SoftForkActivated => val c1 = asRep[Short](argsV(0)) val c2 = asRep[Byte](argsV(1)) val c3 = stypeToElem(typeSubst.apply(tT)) diff --git a/sc/shared/src/test/scala/sigma/LanguageSpecificationV6.scala b/sc/shared/src/test/scala/sigma/LanguageSpecificationV6.scala index e6844e736..5938aa03e 100644 --- a/sc/shared/src/test/scala/sigma/LanguageSpecificationV6.scala +++ b/sc/shared/src/test/scala/sigma/LanguageSpecificationV6.scala @@ -1833,29 +1833,6 @@ class LanguageSpecificationV6 extends LanguageSpecificationBase { suite => ) } - property("Context.getVar") { - - def getVar = { - newFeature( - { (x: Context) => x.getVar[Boolean](11)}, - "{ (x: Context) => CONTEXT.getVar[Boolean](11.toByte) }", - FuncValue(Array((1, SContext)), GetVar(11.toByte, SOption(SBoolean))), - sinceVersion = VersionContext.V6SoftForkVersion - ) - } - - val (_, ctx2, ctx3, ctx4) = contextData() - - verifyCases( - Seq( - ctx2 -> new Expected(ExpectedResult(Success(Some(true)), None)), - ctx3 -> new Expected(ExpectedResult(Failure(new sigma.exceptions.InvalidType("Cannot getVar[Boolean](11): invalid type of value TestValue(0) at id=11")), None)), // not expected type in context var - ctx4 -> new Expected(ExpectedResult(Success(Some(false)), None)) - ), - getVar - ) - } - property("Option.getOrElse with lazy default") { val trace = TracedCost( diff --git a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala index 0655aaf8e..973966fe4 100644 --- a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala @@ -554,10 +554,11 @@ class ErgoTreeSpecification extends SigmaDslTesting with ContractsTestkit with C MInfo(1, dataInputsMethod), MInfo(2, headersMethod), MInfo(3, preHeaderMethod), MInfo(4, inputsMethod), MInfo(5, outputsMethod), MInfo(6, heightMethod), MInfo(7, selfMethod), MInfo(8, selfBoxIndexMethod), MInfo(9, lastBlockUtxoRootHashMethod), - MInfo(10, minerPubKeyMethod)) ++ (if(VersionContext.current.isV6SoftForkActivated){ - Seq(MInfo(11, getVarV6Method), MInfo(12, getVarFromInputMethod)) + MInfo(10, minerPubKeyMethod), MInfo(11, getVarV5Method) + ) ++ (if(VersionContext.current.isV6SoftForkActivated){ + Seq(MInfo(12, getVarFromInputMethod)) } else { - Seq(MInfo(11, getVarV5Method)) + Seq.empty[MInfo] }), true) }, { import SGlobalMethods._