Skip to content

Commit

Permalink
core-serializers2: moved Digest32Coll to core
Browse files Browse the repository at this point in the history
  • Loading branch information
aslesarenko committed Sep 20, 2023
1 parent 3f85433 commit 2ddc80d
Show file tree
Hide file tree
Showing 24 changed files with 37 additions and 38 deletions.
9 changes: 9 additions & 0 deletions core/shared/src/main/scala/sigma/data/package.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package sigma

import supertagged.TaggedType

import scala.annotation.nowarn
import scala.reflect.classTag

Expand Down Expand Up @@ -47,4 +49,11 @@ package object data {

type KeyValueColl = Coll[(Coll[Byte], Coll[Byte])]

trait BaseDigestColl extends TaggedType[Coll[Byte]]

object Digest32Coll extends BaseDigestColl

type Digest32Coll = Digest32Coll.Type

implicit val Digest32CollRType: RType[data.Digest32Coll] = RType[Coll[Byte]].asInstanceOf[RType[data.Digest32Coll]]
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import sigma.Extensions.ArrayOps
import sigma.ast.SCollection.SByteArray
import sigma.ast.{SCollection, SLong, STuple, SType}
import sigma.ast.SType.AnyOps
import sigma.data.SigmaConstants
import sigma.data.{Digest32Coll, SigmaConstants}
import sigmastate.Values._
import sigmastate.eval._
import sigmastate.serialization.SigmaSerializer
import sigmastate.utils.{Helpers, SigmaByteReader, SigmaByteWriter}
import sigmastate.utxo.ExtractCreationInfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import scorex.util.{ModifierId, bytesToId}
import sigma.Extensions.{ArrayOps, CollOps}
import sigma.ast.SType
import sigma.ast.SType.AnyOps
import sigma.data.Digest32Coll
import sigma.util.safeNewArray
import sigma.{Coll, Colls}
import sigmastate.Values._
import sigmastate.eval._
import sigmastate.serialization.ErgoTreeSerializer.DefaultSerializer
import sigmastate.serialization.SigmaSerializer
import sigmastate.utils.{SigmaByteReader, SigmaByteWriter}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import scorex.crypto.authds.ADKey
import scorex.crypto.hash.Blake2b256
import scorex.util._
import sigma.Colls
import sigma.data.Digest32Coll
import sigma.util.safeNewArray
import sigmastate._
import sigmastate.eval.Extensions._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import scorex.crypto.authds.{ADKey, ADValue}
import scorex.util.encode.Base16
import sigma.ast.SType.AnyOps
import sigma.ast.{SBoolean, SCollection, SCollectionType, SType}
import sigma.data.{CAnyValue, Nullable, RType, SigmaBoolean}
import sigma.data.{CAnyValue, Digest32Coll, Nullable, RType, SigmaBoolean}
import sigma.{Coll, _}
import sigmastate.Platform
import sigmastate.Values.{Constant, ConstantNode, SigmaPropConstant, SigmaPropValue, Value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ package object eval {
*/
val SigmaDsl = CSigmaDslBuilder

trait BaseDigestColl extends TaggedType[Coll[Byte]]

object Digest32Coll extends BaseDigestColl

type Digest32Coll = Digest32Coll.Type
implicit val Digest32CollRType: RType[Digest32Coll] = RType[Coll[Byte]].asInstanceOf[RType[Digest32Coll] ]

/** Implicit conversions between Dsl type and the type wrapped by the corresponding type Dsl type.
* Here BigInt is Dsl type and BigInteger is wrapped type.
* @see `sigma.CBigInt`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ package sigmastate.utils
import org.ergoplatform.ErgoBox.TokenId
import scorex.util.{ModifierId, idToBytes}
import scorex.utils.{Ints, Longs, Shorts}
import sigmastate.eval.{Digest32Coll, SigmaDsl}
import sigma.data.Digest32Coll
import sigmastate.eval.SigmaDsl
import sigma.{Coll, Colls}

object Extensions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.scalacheck.Arbitrary._
import org.scalacheck.Gen.{choose, frequency}
import org.scalacheck.util.Buildable
import org.scalacheck.{Arbitrary, Gen}
import sigma.data.{AvlTreeData, AvlTreeFlags, CAND, COR, CTHRESHOLD, ProveDHTuple, ProveDlog, RType, SigmaBoolean}
import sigma.data._
import scorex.crypto.authds.{ADDigest, ADKey}
import scorex.util.encode.{Base58, Base64}
import scorex.util.{ModifierId, bytesToId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import org.scalacheck.Arbitrary.arbitrary
import org.scalacheck.Gen.containerOfN
import org.scalacheck.util.Buildable
import org.scalacheck.{Arbitrary, Gen}
import sigma.data.{AvlTreeData, AvlTreeFlags, CAND, CAvlTree, CBigInt, COR, CSigmaProp, ProveDHTuple, ProveDlog, RType}
import sigma.data._
import scorex.crypto.authds.{ADKey, ADValue}
import scorex.crypto.hash.{Blake2b256, Digest32}
import scorex.util.ModifierId
import sigmastate.Values.{ByteArrayConstant, ConcreteCollection, ConstantPlaceholder, ErgoTree, FalseLeaf, IntConstant, LongConstant, SigmaPropConstant, TrueLeaf}
import sigmastate.eval._
import sigma.Extensions.ArrayOps
import sigmastate.eval.{CHeader, CPreHeader, CBox, CSigmaDslBuilder, SigmaDsl}
import sigmastate.eval.{CBox, CHeader, CPreHeader, CSigmaDslBuilder, SigmaDsl}
import sigmastate.helpers.TestingCommons
import sigmastate.serialization.ErgoTreeSerializer
import sigmastate.serialization.generators.ObjectGenerators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import scorex.util.ModifierId
import sigma.Extensions.ArrayOps
import sigma.SigmaDslTesting
import sigma.ast._
import sigma.data.{AvlTreeData, AvlTreeFlags, CollType}
import sigma.data.{AvlTreeData, AvlTreeFlags, CollType, Digest32Coll}
import sigmastate.Values._
import sigmastate._
import sigmastate.eval._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import sigmastate.helpers.TestingHelpers.copyTransaction
import sigmastate.utils.Helpers
import sigma.SigmaDslTesting
import sigma.Extensions._
import sigma.data.{CSigmaProp, TrivialProp}
import sigma.data.{CSigmaProp, Digest32Coll, TrivialProp}

class ErgoLikeTransactionSpec extends SigmaDslTesting {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import scorex.crypto.hash.Blake2b256
import scorex.util.Random
import sigma.Colls
import sigma.ast.SByte
import sigma.data.{AvlTreeData, ProveDlog, TrivialProp}
import sigma.data.{AvlTreeData, Digest32Coll, ProveDlog, TrivialProp}
import sigma.util.BenchmarkUtil.measure
import sigmastate.Values.{ByteArrayConstant, CollectionConstant, ErgoTree, IntConstant, SigmaPropConstant}
import sigmastate._
Expand All @@ -21,7 +21,6 @@ import sigmastate.interpreter.{ContextExtension, ProverResult}
import sigmastate.lang.Terms.ValueOps
import sigmastate.serialization.ValueSerializer
import sigmastate.utxo.{ByIndex, ExtractCreationInfo, SelectField}
import sigmastate.eval.Digest32Coll
import sigmastate.utils.Helpers._

import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.ergoplatform.dsl.ContractSyntax.Token
import org.ergoplatform.dsl.ErgoContractSpec
import sigma.Coll
import scorex.crypto.hash.Blake2b256
import sigmastate.eval.Digest32Coll
import sigma.data.Digest32Coll

class AssetsAtomicExchangeErgoTests extends CompilerTestingCommons { suite =>
lazy val spec = new ErgoContractSpec()(new TestingIRContext)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ import scorex.crypto.hash.Blake2b256
import sigma.ast.SCollection.SByteArray
import sigmastate._
import sigma.ast._
import sigma.data.{CSigmaProp, TrivialProp}
import sigma.data.{CSigmaProp, Digest32Coll, TrivialProp}
import sigmastate.Values.{BlockValue, ByteArrayConstant, LongConstant, ValDef, ValUse, Value}
import sigmastate.eval.Digest32Coll
import sigmastate.eval.Extensions._
import sigmastate.lang.Terms.ValueOps
import sigmastate.utxo._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import scorex.crypto.authds.{ADKey, ADValue}
import scorex.crypto.hash.{Blake2b256, Digest32}
import sigma.Colls
import sigma.ast.SByte
import sigma.data.{AvlTreeData, AvlTreeFlags}
import sigma.data.{AvlTreeData, AvlTreeFlags, Digest32Coll}
import sigmastate.Values._
import sigmastate._
import sigmastate.crypto.CryptoConstants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import scorex.crypto.authds.{ADKey, ADValue}
import scorex.crypto.authds.avltree.batch.{BatchAVLProver, Insert, Lookup}
import scorex.crypto.hash.{Blake2b256, Digest32}
import sigma.Colls
import sigma.data.{AvlTreeData, AvlTreeFlags, TrivialProp}
import sigma.data.{AvlTreeData, AvlTreeFlags, Digest32Coll, TrivialProp}
import sigmastate.CompilerCrossVersionProps
import sigmastate.Values.{AvlTreeConstant, ByteArrayConstant, LongConstant, SigmaPropConstant}
import sigma.Extensions.ArrayOps
import sigmastate.eval.{Digest32Coll, IRContext, SigmaDsl}
import sigmastate.eval.{IRContext, SigmaDsl}
import sigmastate.helpers.{CompilerTestingCommons, ContextEnrichingTestProvingInterpreter, ErgoLikeContextTesting, ErgoLikeTestProvingInterpreter}
import sigmastate.helpers.TestingHelpers._
import sigmastate.interpreter.Interpreter.ScriptNameProp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.ergoplatform._
import org.ergoplatform.dsl.ContractSyntax.Token
import org.ergoplatform.dsl.{ContractSpec, SigmaContractSyntax, StdContracts, TestContractSpec}
import scorex.crypto.hash.Blake2b256
import sigmastate.eval.Digest32Coll
import sigma.data.Digest32Coll
import sigmastate.helpers.CompilerTestingCommons
import sigma.Coll
import sigma.Context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.ergoplatform._
import org.ergoplatform.dsl.ContractSyntax.Token
import org.ergoplatform.dsl.{ContractSpec, SigmaContractSyntax, StdContracts, TestContractSpec}
import scorex.crypto.hash.Blake2b256
import sigmastate.eval.Digest32Coll
import sigma.data.Digest32Coll
import sigmastate.helpers.CompilerTestingCommons
import sigma.Coll
import sigma.Context
Expand Down
6 changes: 3 additions & 3 deletions sdk/js/src/main/scala/org/ergoplatform/sdk/js/Isos.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import scorex.util.encode.Base16
import sigma.Extensions.CollBytesOps
import sigma.ast.SType
import sigma.data.Iso.{isoStringToArray, isoStringToColl}
import sigma.data.{CBigInt, CGroupElement, Iso}
import sigma.data.{CBigInt, CGroupElement, Digest32Coll, Iso}
import sigma.js.{AvlTree, GroupElement, Type, Value}
import sigma.{Coll, Colls, Evaluation}
import sigmastate.Values.{Constant, GroupElementConstant}
import sigmastate.eval.{CHeader, CPreHeader, Digest32Coll}
import sigmastate.eval.{CHeader, CPreHeader}
import sigmastate.fleetSdkCommon.distEsmTypesBoxesMod.Box
import sigmastate.fleetSdkCommon.distEsmTypesCommonMod.HexString
import sigmastate.fleetSdkCommon.distEsmTypesRegistersMod.NonMandatoryRegisters
Expand All @@ -24,7 +24,7 @@ import sigmastate.fleetSdkCommon.distEsmTypesTransactionsMod.{SignedTransaction,
import sigmastate.fleetSdkCommon.{distEsmTypesBoxesMod => boxesMod, distEsmTypesCommonMod => commonMod, distEsmTypesContextExtensionMod => contextExtensionMod, distEsmTypesInputsMod => inputsMod, distEsmTypesProverResultMod => proverResultMod, distEsmTypesRegistersMod => registersMod, distEsmTypesTokenMod => tokenMod}
import sigmastate.interpreter.{ContextExtension, ProverResult}
import sigmastate.serialization.{ErgoTreeSerializer, ValueSerializer}

import sigma.data.Digest32CollRType
import java.math.BigInteger
import scala.collection.immutable.ListMap
import scala.scalajs.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ import scorex.util.{ModifierId, bytesToId, idToBytes}
import sigma.ast.SType
import sigma.crypto.{CryptoFacade, EcPointType}
import sigma.data.ExactIntegral.LongIsExactIntegral
import sigma.data.{InverseIso, Iso, ProveDHTuple, ProveDlog, RType, SigmaBoolean, SigmaConstants}
import sigma.data.{Digest32Coll, InverseIso, Iso, ProveDHTuple, ProveDlog, RType, SigmaBoolean, SigmaConstants}
import sigma.serialization.GroupElementSerializer
import sigma.util.StringUtil.StringUtilExtensions
import sigma.{AnyValue, AvlTree, Coll, Colls, Evaluation, GroupElement, Header}
import sigmastate.Values.{Constant, ErgoTree, EvaluatedValue, SValue, SigmaPropConstant}
import sigmastate.crypto.DiffieHellmanTupleProverInput
import sigmastate.eval.{CSigmaDslBuilder, Digest32Coll}
import sigmastate.eval.CSigmaDslBuilder
import sigmastate.serialization.{ErgoTreeSerializer, SigmaSerializer, ValueSerializer}

import java.lang.{Boolean => JBoolean, Byte => JByte, Integer => JInt, Long => JLong, Short => JShort, String => JString}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import org.ergoplatform.ErgoBoxCandidate
import org.ergoplatform.ErgoLikeContext
import sigma.Extensions.ArrayOps
import sigma.ast.SType
import sigma.data.{AvlTreeData, AvlTreeFlags, CBigInt, WrapperOf}
import sigma.data.{AvlTreeData, AvlTreeFlags, CBigInt, Digest32Coll, WrapperOf}
import sigma.validation.SigmaValidationSettings

import scala.collection.mutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import sigmastate.utils.Extensions.ModifierIdOps
import sigma.Coll
import sigma.Extensions.CollBytesOps
import sigma.PreHeader
import sigma.data.Digest32CollRType

import scala.collection.mutable.ArrayBuffer
import scala.util.Try
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ import scorex.crypto.authds.{ADDigest, ADKey}
import scorex.util.ModifierId
import scorex.util.encode.Base16
import sigma.ast.SType
import sigma.data.{AvlTreeData, ProveDlog}
import sigma.data.{AvlTreeData, Digest32Coll, ProveDlog}
import sigma.{Coll, Header, PreHeader}
import sigmastate.Values.{ByteArrayConstant, ByteConstant, ErgoTree, EvaluatedValue, IntConstant, LongArrayConstant, SigmaPropConstant}
import sigmastate.crypto.CryptoConstants
import sigmastate.eval.Digest32Coll
import sigmastate.interpreter.{ContextExtension, ProverResult}
import sigmastate.serialization.SerializationSpecification
import sigmastate.utils.Helpers.DecoderResultOps // required for Scala 2.11
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ import org.ergoplatform.{ErgoBox, ErgoBoxCandidate, ErgoTreePredef, UnsignedErgo
import sigma.Extensions.ArrayOps
import scorex.util.{ModifierId, bytesToId}
import sigma.crypto.CryptoFacade
import sigma.data.ProveDlog
import sigma.data.{Digest32Coll, ProveDlog}
import sigmastate.eval.Extensions.{EvalIterableOps, SigmaBooleanOps}
import sigmastate.eval._
import sigmastate.helpers.TestingHelpers._

trait Generators {
Expand Down

0 comments on commit 2ddc80d

Please sign in to comment.