-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prohibition for using 6.0 types in register and context extension vars #1047
base: v6.0.0
Are you sure you want to change the base?
Conversation
case c: Constant[_] => v6TypeCheck(c.tpe) | ||
case c: EvaluatedCollection[_, _] => v6TypeCheck(c.elementType) | ||
case GroupGenerator => | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the motivation to add and check this rule?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem is that deserialization of values in registers and context extension is not versioned, so newly supported serializable types (Header, Option[], UnsignedBigInt) can't be put there (but serialized as Coll[Byte] value can be put there to be used with Global.deserialize )
} | ||
} | ||
v match { | ||
case c: Constant[_] => v6TypeCheck(c.tpe) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems it is possible to serialize/parse Tuple with v6 type
property("impossible to use v6 types in box registers") {
val trueProp = ErgoTreePredef.TrueProp(ErgoTree.defaultHeaderWithVersion(3))
val b = new ErgoBoxCandidate(1L, trueProp, 1,
additionalRegisters = Map(R4 -> Tuple(UnsignedBigIntConstant(new BigInteger("1")), IntConstant(1))))
VersionContext.withVersions(3, 3) {
val bs = ErgoBoxCandidate.serializer.toBytes(b)
a[sigma.validation.ValidationException] should be thrownBy ErgoBoxCandidate.serializer.fromBytes(bs)
}
}
doesn't throw exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SethDusek fixed, the reason was c.elementType being SAny for Tuple. Made test for UBI as second tuple element, and collection as well
No description provided.