From b2df20fb6005bf06dd28cfe8f6b1df7f6b3de9e5 Mon Sep 17 00:00:00 2001 From: Alexander Chepurnoy Date: Mon, 13 Jan 2025 18:51:57 +0300 Subject: [PATCH] removing getvar v6 --- .../src/main/scala/sigma/ast/methods.scala | 16 +++------------- .../scala/sigma/compiler/ir/GraphBuilding.scala | 6 +----- .../scala/sigmastate/ErgoTreeSpecification.scala | 7 ++++--- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/data/shared/src/main/scala/sigma/ast/methods.scala b/data/shared/src/main/scala/sigma/ast/methods.scala index a69654de7..f47e6066e 100644 --- a/data/shared/src/main/scala/sigma/ast/methods.scala +++ b/data/shared/src/main/scala/sigma/ast/methods.scala @@ -1804,14 +1804,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( @@ -1825,15 +1817,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 f5235aba5..4b62fe3d9 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/sigmastate/ErgoTreeSpecification.scala b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala index 0504a79c6..10828df5b 100644 --- a/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala +++ b/sc/shared/src/test/scala/sigmastate/ErgoTreeSpecification.scala @@ -550,10 +550,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._