Skip to content

Commit

Permalink
minimize-modules: RType implicits moved from SType
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Aug 26, 2023
1 parent 3eba2d1 commit 71e67c4
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Runs tests and collect coverage
run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} commonJS/test interpreterJS/test parsersJS/test sdkJS/test scJS/test
run: sbt -jvm-opts ci/ci.jvmopts ++${{ matrix.scala }} coreJS/test interpreterJS/test parsersJS/test sdkJS/test scJS/test

- name: Publish a JVM snapshot ${{ github.ref }}
if: env.HAS_SECRETS == 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import scorex.crypto.hash.Blake2b256
import scorex.util._
import sigma.Colls
import sigma.util.safeNewArray
import sigmastate.SType._
import sigmastate._
import sigmastate.eval.Extensions._
import sigmastate.eval._
import sigmastate.interpreter.ProverResult
Expand Down
17 changes: 17 additions & 0 deletions interpreter/shared/src/main/scala/sigmastate/sigmastate.scala
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
import org.ergoplatform.{ErgoBox, ErgoBoxCandidate, ErgoLikeContext}
import sigma.data.{GeneralType, RType}
import sigmastate.Values._
import sigmastate.lang.CheckingSigmaBuilder

import scala.reflect.classTag

package object sigmastate {
import CheckingSigmaBuilder._

/** RType descriptors for predefined types used in AOTC-based interpreter. */
def rtypeToClassTag = ???

implicit val SigmaBooleanRType : RType[SigmaBoolean] = RType.fromClassTag(classTag[SigmaBoolean])

implicit val ErgoBoxRType : RType[ErgoBox] = RType.fromClassTag(classTag[ErgoBox])

implicit val ErgoBoxCandidateRType: RType[ErgoBoxCandidate] = RType.fromClassTag(classTag[ErgoBoxCandidate])

implicit val AvlTreeDataRType : RType[AvlTreeData] = GeneralType(classTag[AvlTreeData])

implicit val ErgoLikeContextRType : RType[ErgoLikeContext] = RType.fromClassTag(classTag[ErgoLikeContext])

/** Helper method to create "+" operation node. */
def Plus[T <: SNumericType](left: Value[T], right: Value[T]): Value[T] =
mkPlus(left, right)
Expand Down
8 changes: 0 additions & 8 deletions interpreter/shared/src/main/scala/sigmastate/types.scala
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ object SType {
/** Costructs a collection type with the given type of elements. */
implicit def typeCollection[V <: SType](implicit tV: V): SCollection[V] = SCollection[V](tV)

/** RType descriptors for predefined types used in AOTC-based interpreter. */
def rtypeToClassTag = ???
implicit val SigmaBooleanRType: RType[SigmaBoolean] = RType.fromClassTag(classTag[SigmaBoolean])
implicit val ErgoBoxRType: RType[ErgoBox] = RType.fromClassTag(classTag[ErgoBox])
implicit val ErgoBoxCandidateRType: RType[ErgoBoxCandidate] = RType.fromClassTag(classTag[ErgoBoxCandidate])
implicit val AvlTreeDataRType: RType[AvlTreeData] = GeneralType(classTag[AvlTreeData])
implicit val ErgoLikeContextRType: RType[ErgoLikeContext] = RType.fromClassTag(classTag[ErgoLikeContext])

/** Named type variables and parameters used in generic types and method signatures.
* Generic type terms like `(Coll[IV],(IV) => Boolean) => Boolean` are used to represent
* method types of `Coll`` and `Option`` types. Each such type is an instance of [[SFunc]].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import sigmastate.interpreter.{ContextExtension, ProverResult}
import sigmastate.serialization.SigmaSerializer
import sigmastate.eval._
import sigmastate.eval.Extensions._
import sigmastate._
import sigmastate.SType._
import sigmastate.helpers.TestingHelpers.copyTransaction
import sigmastate.utils.Helpers
Expand Down

0 comments on commit 71e67c4

Please sign in to comment.