Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getvar variant for 6.0 removed #1050

Open
wants to merge 1 commit into
base: v6.0.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading