Skip to content

Commit

Permalink
isV6SoftFork... fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
kushti committed Jan 20, 2025
1 parent 9411e54 commit 5820bd0
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion data/shared/src/main/scala/sigma/ast/methods.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ case object SAvlTreeMethods extends MonoTypeMethods {
lazy val v6Methods = v5Methods ++ Seq(insertOrUpdateMethod)

protected override def getMethods(): Seq[SMethod] = {
if (VersionContext.current.isV6SoftForkActivated) {
if (VersionContext.current.isV6Activated) {
v6Methods
} else {
v5Methods
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ object Extensions {
val bv = CAvlTreeVerifier(tree, proof)
entries.forall { case (key, value) =>
val insertRes = bv.performOneOperation(Insert(ADKey @@ key.toArray, ADValue @@ value.toArray))
if (insertRes.isFailure && !VersionContext.current.isV6SoftForkActivated) {
if (insertRes.isFailure && !VersionContext.current.isV6Activated) {
syntax.error(s"Incorrect insert for $tree (key: $key, value: $value, digest: ${tree.digest}): ${insertRes.failed.get}}")
}
insertRes.isSuccess
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ class CErgoTreeEvaluator(
addSeqCost(InsertIntoAvlTree_Info, nItems) { () =>
val insertRes = bv.performInsert(key.toArray, value.toArray)
// For versioned change details, see see https://github.com/ScorexFoundation/sigmastate-interpreter/issues/908
if (insertRes.isFailure && !VersionContext.current.isV6SoftForkActivated) {
if (insertRes.isFailure && !VersionContext.current.isV6Activated) {
syntax.error(s"Incorrect insert for $tree (key: $key, value: $value, digest: ${tree.digest}): ${insertRes.failed.get}}")
}
res = insertRes.isSuccess
Expand Down
4 changes: 2 additions & 2 deletions sc/shared/src/test/scala/sigma/LanguageSpecificationV6.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3040,7 +3040,7 @@ class LanguageSpecificationV6 extends LanguageSpecificationBase { suite =>
val tree = createTree(preInsertDigest, insertAllowed = true)
val invalidKvs = Colls.fromItems((key -> value), (key -> value))
val input = (tree, (invalidKvs, insertProof))
if (VersionContext.current.isV6SoftForkActivated) {
if (VersionContext.current.isV6Activated) {
insert.verifyCase(input, new Expected(ExpectedResult(Success(None), Some(2103))))
} else {
val res = insert.checkEquality(input)
Expand All @@ -3053,7 +3053,7 @@ class LanguageSpecificationV6 extends LanguageSpecificationBase { suite =>
val tree = createTree(preInsertDigest, insertAllowed = true)
val invalidProof = insertProof.map(x => (-x).toByte) // any other different from proof
val input = (tree, (kvs, invalidProof))
if (VersionContext.current.isV6SoftForkActivated) {
if (VersionContext.current.isV6Activated) {
insert.verifyCase(input, new Expected(ExpectedResult(Success(None), Some(2103))))
} else {
val res = insert.checkEquality(input)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3241,7 +3241,7 @@ class BasicOpsSpecification extends CompilerTestingCommons
true
)

if (VersionContext.current.isV6SoftForkActivated) {
if (VersionContext.current.isV6Activated) {
deserTest()
} else {
an[ValidationException] should be thrownBy deserTest()
Expand All @@ -3262,7 +3262,7 @@ class BasicOpsSpecification extends CompilerTestingCommons
)
}

if (VersionContext.current.isV6SoftForkActivated) {
if (VersionContext.current.isV6Activated) {
someTest(okValue)
// on JVM, InvocationTargetException wrapping (ArithmeticException: BigInteger out of 256 bit range) is thrown
an[Exception] should be thrownBy someTest(invalidValue)
Expand Down

0 comments on commit 5820bd0

Please sign in to comment.