-
Notifications
You must be signed in to change notification settings - Fork 205
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
base: main
Are you sure you want to change the base?
Conversation
… introduce opaque types to model byte strings
// 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; |
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.
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))) |
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.
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))) |
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.
TODO: make similar change to canton
@@ -363,6 +364,12 @@ object SValue { | |||
Either.cond(test = s.abs <= MaxScale, right = s.toInt, left = "invalide scale") |
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.
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", |
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.
Added so that the lf-value-json
may access the protobuf ByteString
data structure
@@ -32,6 +32,7 @@ da_scala_library( | |||
"//daml-lf/data", | |||
"//daml-lf/transaction", | |||
"//ledger-service/lf-value-json", | |||
"@maven//:com_google_protobuf_protobuf_java", |
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.
Added so that the ledger codegen may access the protobuf ByteString
data structure
TODO:
Bytes
data types