Skip to content

Commit

Permalink
Header.bytes removed
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Aug 18, 2024
1 parent d8cc09d commit 57e39be
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 21 deletions.
2 changes: 0 additions & 2 deletions core/shared/src/main/scala/sigma/SigmaDsl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,6 @@ trait Header {
def serializeWithoutPoW: Coll[Byte]

def checkPow: Boolean

def bytes: Coll[Byte]
}

/** Runtime representation of Context ErgoTree type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,9 +349,6 @@ object ReflectionData {
},
mkMethod(clazz, "checkPow", Array[Class[_]]()) { (obj, _) =>
obj.asInstanceOf[Header].checkPow
},
mkMethod(clazz, "bytes", Array[Class[_]]()) { (obj, _) =>
obj.asInstanceOf[Header].bytes
}
)
)
Expand Down
2 changes: 0 additions & 2 deletions data/shared/src/main/scala/sigma/data/CHeader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ case class CHeader(ergoHeader: ErgoHeader) extends Header with WrapperOf[ErgoHea
}
}

override def bytes: Coll[Byte] = Colls.fromArray(ergoHeader.bytes)

}

object CHeader {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@ import org.scalatest.BeforeAndAfterAll
import scorex.util.encode.{Base16, Base58}
import sigma.Colls
import sigma.VersionContext.V6SoftForkVersion
import sigma.data.{CAND, CAvlTree, ProveDlog, SigmaBoolean, TrivialProp}
import sigma.data.{CAND, CAvlTree, CHeader, ProveDlog, SigmaBoolean, TrivialProp}
import sigma.interpreter.ContextExtension
import scorex.util.encode.Base58
import sigma.VersionContext
import sigma.crypto.CryptoConstants
import sigma.data.{AvlTreeData, CAND, ProveDlog, SigmaBoolean, TrivialProp}
import sigma.util.Extensions.IntOps
import sigmastate.helpers.{CompilerTestingCommons, ErgoLikeContextTesting, ErgoLikeTestInterpreter, ErgoLikeTestProvingInterpreter}
import sigmastate.helpers.TestingHelpers._
Expand Down Expand Up @@ -497,7 +494,7 @@ class TestingInterpreterSpecification extends CompilerTestingCommons

property("bytes") {

val headerBytes = Base16.encode(contextHeader.bytes.toArray)
val headerBytes = Base16.encode(contextHeader.asInstanceOf[CHeader].ergoHeader.bytes)

// checking hash of bytes(id) against known value
val source = s""" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ import scorex.crypto.authds.avltree.batch.{BatchAVLProver, Insert}
import scorex.crypto.hash.{Blake2b256, Digest32}
import scorex.util.ByteArrayBuilder
import scorex.util.encode.Base16
import scorex.util.serialization.{VLQByteBufferReader, VLQByteBufferWriter}
import scorex.utils.{Ints, Longs, Shorts}
import sigma.{BigInt, Colls, SigmaTestingData}
import scorex.util.encode.Base16
import scorex.util.serialization.VLQByteBufferWriter
import scorex.utils.Longs
import sigma.{Colls, SigmaTestingData}
import sigma.Extensions.ArrayOps
import sigma.VersionContext.V6SoftForkVersion
import sigma.ast.SCollection.SByteArray
import sigma.ast.SType.AnyOps
import sigma.data.{AvlTreeData, AvlTreeFlags, CAND, CAnyValue, CSigmaDslBuilder, CSigmaProp}
import sigma.data.{AvlTreeData, AvlTreeFlags, CAND, CAnyValue, CHeader, CSigmaDslBuilder, CSigmaProp}
import sigma.util.StringUtil._
import sigma.ast._
import sigma.ast.syntax._
Expand All @@ -29,10 +28,9 @@ import sigmastate.interpreter.Interpreter._
import sigma.ast.Apply
import sigma.eval.EvalSettings
import sigma.exceptions.InvalidType
import sigma.serialization.{ConstantStore, DataSerializer, ErgoTreeSerializer, SigmaByteReader, SigmaByteWriter, ValueSerializer}
import sigma.serialization.{DataSerializer, ErgoTreeSerializer, SigmaByteWriter}
import sigma.util.Extensions
import sigmastate.utils.Helpers
import sigma.serialization.ErgoTreeSerializer
import sigmastate.utils.Helpers._

import java.math.BigInteger
Expand Down Expand Up @@ -420,7 +418,7 @@ class BasicOpsSpecification extends CompilerTestingCommons
property("deserializeTo - header") {
val td = new SigmaTestingData {}
val h1 = td.TestData.h1
val headerBytes = h1.bytes
val headerBytes = h1.asInstanceOf[CHeader].ergoHeader.bytes

val headerStateBytes = AvlTreeData.serializer.toBytes(Extensions.CoreAvlTreeOps(h1.stateRoot).toAvlTreeData)
val customExt = Seq(21.toByte -> ByteArrayConstant(headerBytes), 22.toByte -> ByteArrayConstant(headerStateBytes))
Expand All @@ -447,7 +445,7 @@ class BasicOpsSpecification extends CompilerTestingCommons

property("deserializeTo - header option") {
val td = new SigmaTestingData {}
val h1 = td.TestData.h1
val h1 = td.TestData.h1.asInstanceOf[CHeader].ergoHeader
val headerBytes = Colls.fromArray(Array(1.toByte) ++ h1.bytes.toArray)

val customExt = Seq(21.toByte -> ByteArrayConstant(headerBytes))
Expand Down

0 comments on commit 57e39be

Please sign in to comment.