Skip to content

Commit

Permalink
removing getvar v6
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Jan 13, 2025
1 parent d13dd4d commit b2df20f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
16 changes: 3 additions & 13 deletions data/shared/src/main/scala/sigma/ast/methods.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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._
Expand Down

0 comments on commit b2df20f

Please sign in to comment.