Skip to content

Commit

Permalink
removing checkType parameter which is always true
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Dec 6, 2024
1 parent c1dc254 commit 2effbba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,8 @@ class ErgoTreeSerializer(protocolVersion: Byte = VersionContext.V6SoftForkVersio
val r = SigmaSerializer.startReader(bytes)
deserializeErgoTree(r, SigmaSerializer.MaxPropositionSize)
}

def deserializeErgoTree(r: SigmaByteReader, maxTreeSizeBytes: Int): ErgoTree = {
deserializeErgoTree(r, maxTreeSizeBytes, true)
}

private[sigma] def deserializeErgoTree(r: SigmaByteReader, maxTreeSizeBytes: Int, checkType: Boolean): ErgoTree = {
val startPos = r.position
val previousPositionLimit = r.positionLimit
r.positionLimit = r.position + maxTreeSizeBytes
Expand All @@ -158,9 +154,7 @@ class ErgoTreeSerializer(protocolVersion: Byte = VersionContext.V6SoftForkVersio
val isUsingBlockchainContext = r.wasUsingBlockchainContext // == true if there was a node using the blockchain context
r.wasUsingBlockchainContext = wasUsingBlockchainContext_saved

if (checkType) {
CheckDeserializedScriptIsSigmaProp(root)
}
CheckDeserializedScriptIsSigmaProp(root)

r.constantStore = previousConstantStore
// now we know the end position of propositionBytes, read them all at once into array
Expand Down Expand Up @@ -391,8 +385,4 @@ class ErgoTreeSerializer(protocolVersion: Byte = VersionContext.V6SoftForkVersio
(resBytes, nConstants)
}

}

object ErgoTreeSerializer {
val DefaultSerializer = new ErgoTreeSerializer
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ trait Interpreter {
val context1 = context.withInitCost(currCost).asInstanceOf[CTX]
val (propTree, context2) = trySoftForkable[(SigmaPropValue, CTX)](whenSoftFork = (TrueSigmaProp, context1)) {
// Before ErgoTree V3 the deserialization cost was not added to the total cost
applyDeserializeContextJITC(if (VersionContext.current.activatedVersion >= VersionContext.V6SoftForkVersion) {
applyDeserializeContextJITC(if (VersionContext.current.isV6SoftForkActivated) {
context1
} else {
context
Expand Down

0 comments on commit 2effbba

Please sign in to comment.