Skip to content

Commit

Permalink
daml-lf: clone dev protobuf for LF 1.7 (digital-asset#3371)
Browse files Browse the repository at this point in the history
  • Loading branch information
remyhaemmerle-da authored and mergify[bot] committed Nov 7, 2019
1 parent c599f24 commit ce36674
Show file tree
Hide file tree
Showing 7 changed files with 1,514 additions and 2 deletions.
5 changes: 4 additions & 1 deletion daml-lf/archive/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ LF_MAJOR_VERSIONS = [
]

LF_VERSIONS = [
"dev",
"1.6",
"1.7",
"dev",
]

[
Expand Down Expand Up @@ -159,6 +160,8 @@ da_scala_test_suite(
deps = [
":daml_lf_1.6_archive_java_proto",
":daml_lf_1.6_archive_proto_srcs",
":daml_lf_1.7_archive_java_proto",
":daml_lf_1.7_archive_proto_srcs",
":daml_lf_archive_reader",
":daml_lf_dev_archive_java_proto",
"//bazel_tools/runfiles:scala_runfiles",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// Copyright (c) 2019 The DAML Authors. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

syntax = "proto3";
package daml_lf_1_7;

option java_package = "com.digitalasset.daml_lf_1_7";
option csharp_namespace = "Com.DigitalAsset.Daml_Lf_1_7.DamlLf";

import "com/digitalasset/daml_lf_1_7/daml_lf_0.proto";
import "com/digitalasset/daml_lf_1_7/daml_lf_1.proto";

message ArchivePayload {
// this is number 3 for historical reasons -- we had
// DAML-LF v0 and v1 before we had minor versions.
string minor = 3;
reserved 9999; // for the removed "dev" major version

oneof Sum {
daml_lf_0.Package daml_lf_0 = 1;
daml_lf_1.Package daml_lf_1 = 2;

// lf_2 = 4, lf_3 = 5, etc
}
}

enum HashFunction {
SHA256 = 0;
}

message Archive {
HashFunction hash_function = 1;

// deprecated field (bytes hash = 2), replaced by
// field 4.

// Must be an encoded ArchivePayload. We store it as `bytes` to
// simplify hashing and in future signing.
bytes payload = 3;
// The hash is simply the ascii7 lowercase hex-encoded hash of the bytes
// according to the hash_function. We store it here for convenience, code
// reading the Archive should verify that the hash is valid.
//
// Note that the hash is computed directly on the blob and not
// on the decoded structure. This means that servers implementing
// a DAML ledger need to store the blob as-is somewhere to be able
// to always offer proof that they have a DAML package matching
// the requested hash. We decided to go for this route rather than
// relying on a canonical encoding of the AST since such a scheme
// would be extremely hard (for example protobuf encoding is not
// canonical) to maintain and does not buy us much.
string hash = 4;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright (c) 2019 The DAML Authors. All rights reserved.
// SPDX-License-Identifier: Apache-2.0

// DAML-LF-0 was a .proto representation of the DAML core stored in
// the legacy sdaml format. We used it to ease transition between
// sdaml and DAML-LF archives. This stub remains so we can
// successfully decode LFv0 archives and then report that they are
// unsupported.

syntax = "proto3";
package daml_lf_0;

option java_package = "com.digitalasset.daml_lf_1_7";
option csharp_namespace = "Com.DigitalAsset.Daml_Lf_1_7.DamlLf0";

message Package {
}
Loading

0 comments on commit ce36674

Please sign in to comment.