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

Add Bytes opaque type to the engine and damlc #20754

Draft
wants to merge 76 commits into
base: main
Choose a base branch
from
Draft

Conversation

carlpulley-da
Copy link
Contributor

@carlpulley-da carlpulley-da commented Feb 10, 2025

TODO:

  • add opaque type to engine
  • add opaque type to damlc
  • determine if we can have statically sized Bytes data types
  • prepare necessary canton code drop changes
  • update daml-lf spec

// Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

package com.daml.ledger.javaapi.data;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: make similar change to canton

@@ -84,6 +84,7 @@ object LfEngineToApi {
case Lf.ValueContractId(c) => Right(api.Value(api.Value.Sum.ContractId(c.coid)))
case Lf.ValueBool(b) => Right(api.Value(api.Value.Sum.Bool(b)))
case Lf.ValueDate(d) => Right(api.Value(api.Value.Sum.Date(d.days)))
case Lf.ValueBytes(bytes) => Right(api.Value(api.Value.Sum.Bytes(bytes.toByteString)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: make similar change to canton

@@ -81,6 +81,7 @@ abstract class ValueValidator {
.map(Lf.ValueDate.apply)
case Sum.Text(text) => Right(Lf.ValueText(text))
case Sum.Int64(value) => Right(Lf.ValueInt64(value))
case Sum.Bytes(bytes) => Right(Lf.ValueBytes(Bytes.fromByteString(bytes)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

TODO: make similar change to canton

@@ -363,6 +364,12 @@ object SValue {
Either.cond(test = s.abs <= MaxScale, right = s.toInt, left = "invalide scale")
Copy link
Contributor Author

@carlpulley-da carlpulley-da Feb 10, 2025

Choose a reason for hiding this comment

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

TODO: invalide -> invalid?

@@ -28,6 +28,7 @@ da_scala_library(
"//daml-lf/api-type-signature",
"//daml-lf/data",
"//daml-lf/transaction",
"@maven//:com_google_protobuf_protobuf_java",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added so that the lf-value-json may access the protobuf ByteString data structure

@carlpulley-da carlpulley-da changed the title Add Bytes opaque type to the engine Add Bytes opaque type to the engine and damlc Feb 10, 2025
@@ -32,6 +32,7 @@ da_scala_library(
"//daml-lf/data",
"//daml-lf/transaction",
"//ledger-service/lf-value-json",
"@maven//:com_google_protobuf_protobuf_java",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added so that the ledger codegen may access the protobuf ByteString data structure

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.

1 participant