Skip to content
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

[6.0] Revise liftToConstant method #1021

Merged
merged 21 commits into from
Dec 5, 2024
Merged

[6.0] Revise liftToConstant method #1021

merged 21 commits into from
Dec 5, 2024

Conversation

kushti
Copy link
Member

@kushti kushti commented Jul 17, 2024

Close #905

@kushti kushti requested a review from aslesarenko December 4, 2024 09:52
@kushti kushti changed the base branch from v6.0.0 to i554 December 4, 2024 09:52
@kushti kushti changed the base branch from i554 to v6.0.0 December 4, 2024 10:33
Copy link
Member

@aslesarenko aslesarenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please see comments

case n: sigma.BigInt => Nullable(mkConstant[SBigInt.type](n, SBigInt))
case n: sigma.UnsignedBigInt => Nullable(mkConstant[SUnsignedBigInt.type](n, SUnsignedBigInt))
case ge: GroupElement => Nullable(mkConstant[SGroupElement.type](ge, SGroupElement))
case b: Boolean => Nullable(if (b) TrueLeaf else FalseLeaf)
case v: String => Nullable(mkConstant[SString.type](v, SString))
case v: String if !VersionContext.current.isV6SoftForkActivated => Nullable(mkConstant[SString.type](v, SString))
case h: Header if VersionContext.current.isV6SoftForkActivated => Nullable(mkConstant[SHeader.type](h, SHeader))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreHeader is also supported type, they usually come together everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

case n: sigma.BigInt => Nullable(mkConstant[SBigInt.type](n, SBigInt))
case ge: GroupElement => Nullable(mkConstant[SGroupElement.type](ge, SGroupElement))
case b: Boolean => Nullable(if (b) TrueLeaf else FalseLeaf)
case v: String => Nullable(mkConstant[SString.type](v, SString))
case h: Header if VersionContext.current.isV6SoftForkActivated => Nullable(mkConstant[SHeader.type](h, SHeader))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreHeader is missing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -122,6 +122,13 @@ class SigmaBuilderTest extends AnyPropSpec with ScalaCheckPropertyChecks with Ma
testSuccess(arr, TransformingSigmaBuilder.mkCollectionConstant(arr, c.tpe))
}

def testArrayFailure[T <: SType]
(v: T#WrappedType, c: Constant[T])(implicit t: RType[T#WrappedType]) = {
// for any Byte and Short value `v`, lifting of array should succeed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't is generic enough to work for any type? Comment somewhat misleading.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@kushti kushti merged commit d13dd4d into v6.0.0 Dec 5, 2024
4 checks passed
@kushti kushti deleted the i905 branch December 5, 2024 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants