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

Fix for Box.getReg v6 - different ids used now #1048

Open
wants to merge 1 commit into
base: v6.0.0
Choose a base branch
from

Conversation

kushti
Copy link
Member

@kushti kushti commented Jan 9, 2025

No description provided.

@@ -1427,7 +1427,7 @@ case object SBoxMethods extends MonoTypeMethods {
ArgInfo("regId", "zero-based identifier of the register."))

lazy val getRegMethodV6 = SMethod(this, "getReg",
SFunc(Array(SBox, SInt), SOption(tT), Array(paramT)), 7, ExtractRegisterAs.costKind, Seq(tT))
SFunc(Array(SBox, SInt), SOption(tT), Array(paramT)), 19, ExtractRegisterAs.costKind, Seq(tT))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 19 and not 9?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why 19 and not 9?

It is occupied by R0, see ErgoTreeSpecification for method ids checks :

{ import SBoxMethods._
      (SBox.typeId,  Seq(
        MInfo(1, ValueMethod),
        MInfo(2, PropositionBytesMethod),
        MInfo(3, BytesMethod),
        MInfo(4, BytesWithoutRefMethod),
        MInfo(5, IdMethod),
        MInfo(6, creationInfoMethod),
        MInfo(8, tokensMethod)
      ) ++ (if (isV6Activated) {
        Seq(MInfo(19, getRegMethodV6))
      } else {
        Seq(MInfo(7, getRegMethodV5))
      }) ++ registers(idOfs = 8)
        .zipWithIndex
        .map { case (m,i) => MInfo((8 + i + 1).toByte, m) }, true)
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants