From f6b801fa54fda7702b508bf40b0dbd70a586c00a Mon Sep 17 00:00:00 2001 From: Alexander Chepurnoy Date: Thu, 26 Dec 2024 15:14:07 +0300 Subject: [PATCH] replacedrule fix --- .../validation/SigmaValidationSettings.scala | 8 +++++++- .../ergoplatform/validation/ValidationRules.scala | 15 ++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/core/shared/src/main/scala/sigma/validation/SigmaValidationSettings.scala b/core/shared/src/main/scala/sigma/validation/SigmaValidationSettings.scala index 51fb97c8ad..70f3c33845 100644 --- a/core/shared/src/main/scala/sigma/validation/SigmaValidationSettings.scala +++ b/core/shared/src/main/scala/sigma/validation/SigmaValidationSettings.scala @@ -1,5 +1,7 @@ package sigma.validation +import sigma.VersionContext + /** * Configuration of validation. Each `ValidationRule` instance should be * implemented as an `object` to facilitate type-safe usage. It then should be @@ -48,7 +50,11 @@ abstract class SigmaValidationSettings extends Iterable[(Short, (ValidationRule, def isSoftFork(ruleId: Short, ve: ValidationException): Boolean = { val infoOpt = get(ruleId) infoOpt match { - case Some((_, ReplacedRule(_))) => true + case Some((vr, ReplacedRule(_))) => if (vr.id == 1011 && VersionContext.current.isV6Activated) { + false + } else { + true + } case Some((rule, status)) => rule.isSoftFork(this, rule.id, status, ve.args) case None => false } diff --git a/data/shared/src/main/scala/org/ergoplatform/validation/ValidationRules.scala b/data/shared/src/main/scala/org/ergoplatform/validation/ValidationRules.scala index 5ad09b7733..ed461aa2f2 100644 --- a/data/shared/src/main/scala/org/ergoplatform/validation/ValidationRules.scala +++ b/data/shared/src/main/scala/org/ergoplatform/validation/ValidationRules.scala @@ -109,8 +109,9 @@ object ValidationRules { final def apply[T](objType: MethodsContainer, methodId: Byte): SMethod = { checkRule() val methodOpt = objType.getMethodById(methodId) - if (methodOpt.isDefined) methodOpt.get - else { + if (methodOpt.isDefined) { + methodOpt.get + } else { throwValidationException( new SerializerException(s"The method with code $methodId doesn't declared in the type $objType."), Array[Any](objType, methodId)) @@ -130,7 +131,15 @@ object ValidationRules { } } - object CheckAndGetMethod extends CheckAndGetMethodTemplate(1011) + object CheckAndGetMethod extends CheckAndGetMethodTemplate(1011) { + override def isSoftFork(vs: SigmaValidationSettings, + ruleId: Short, + status: RuleStatus, + args: Seq[Any]): Boolean = { + false + } + } + object CheckAndGetMethodV6 extends CheckAndGetMethodTemplate(1016) object CheckHeaderSizeBit extends ValidationRule(1012,