Extract state.proto from daml_kvutils.proto [KVL-1090] (#11174)

CHANGELOG_BEGIN

CHANGELOG_END
This commit is contained in:
nicu-da 2021-10-11 01:56:16 -07:00 committed by GitHub
parent 6f7ee0b092
commit 664aedd31b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
74 changed files with 356 additions and 257 deletions

View File

@ -25,6 +25,11 @@ breaking:
# Moving an individual field into a new `one_of` retains binary backwards
# compatibility.
- FIELD_SAME_ONEOF
# `daml_kvutils.proto` file was split into multiple files with different packages during the `v1.18.0` release
# Changing the proto package for a message retains binary backwards compatibility but
# buf treats the message as a new type for existing fields
# This exception will be removed once the latest stable tag contains the updated field types
- FIELD_SAME_TYPE
ignore:
# Changes in daml_lf_1.proto do not impact KV, as it never parses archive
# payload directly

View File

@ -9,9 +9,9 @@ import com.daml.api.util.TimeProvider
import com.daml.caching.Cache
import com.daml.ledger.api.health.{HealthStatus, Healthy}
import com.daml.ledger.on.memory.InMemoryLedgerWriter._
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.api.{CommitMetadata, LedgerWriter}
import com.daml.ledger.participant.state.kvutils.export.LedgerDataExporter
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{KeyValueCommitting, Raw}
import com.daml.ledger.participant.state.v2.SubmissionResult
import com.daml.ledger.resources.{Resource, ResourceContext, ResourceOwner}

View File

@ -21,9 +21,9 @@ import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "com/daml/daml_lf_dev/daml_lf.proto";
import "com/daml/lf/transaction.proto";
import "com/daml/lf/value.proto";
import "com/daml/ledger/configuration/ledger_configuration.proto";
import "com/daml/ledger/participant/state/kvutils/store/state.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/configuration.proto";
// Envelope with which we wrap all kvutils messages that are sent over the network
// or persisted on disk. The envelope specifies the kvutils version that defines how
// a message is decoded and processed. Optionally the message payload may be stored
@ -81,7 +81,7 @@ message DamlLogEntry {
DamlPackageUploadRejectionEntry package_upload_rejection_entry = 5;
// A Daml ledger configuration change.
DamlConfigurationEntry configuration_entry = 6;
com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry configuration_entry = 6;
// A rejected configuration change.
DamlConfigurationRejectionEntry configuration_rejection_entry = 7;
@ -312,21 +312,6 @@ message DamlConfigurationRejectionEntry {
}
}
// Configuration entry that records a configuration change.
// Also used in state to look up latest configuration.
// When a configuration exists, only the participant that
// submitted previously can change it.
message DamlConfigurationEntry {
// The submission from which this configuration originated.
string submission_id = 1;
// Submitting participant's id.
string participant_id = 2;
// The ledger configuration.
com.daml.ledger.configuration.LedgerConfiguration configuration = 3;
}
// An allocation of party name and assignment of a party to a given
// participant.
// A party can only be hosted once (this may not be true in more
@ -374,134 +359,6 @@ message DamlOutOfTimeBoundsEntry {
google.protobuf.Timestamp too_late_from = 4;
}
// Daml state key. [[KeyValueCommitting]] produces effects that are committed
// to the ledger from the `DamlSubmission`: a log entry to be created, and
// the set of Daml state updates.
// The field numbers below must match with the corresponding entries in `DamlStateValue`.
message DamlStateKey {
oneof key {
string package_id = 1;
string contract_id = 2;
DamlCommandDedupKey command_dedup = 3;
string party = 4;
DamlContractKey contract_key = 5;
google.protobuf.Empty configuration = 6;
DamlSubmissionDedupKey submission_dedup = 7;
}
}
// Daml state values pointed to by `DamlStateKey`.
// The field numbers below must match with the corresponding entries in `DamlStateKey`.
message DamlStateValue {
oneof value {
daml_lf_dev.Archive archive = 1;
DamlContractState contract_state = 2;
DamlCommandDedupValue command_dedup = 3;
DamlPartyAllocation party = 4;
DamlContractKeyState contract_key_state = 5;
DamlConfigurationEntry configuration_entry = 6;
DamlSubmissionDedupValue submission_dedup = 7;
}
}
message DamlCommandDedupKey {
repeated string submitters = 1;
string application_id = 2;
string command_id = 3;
}
message DamlCommandDedupValue {
reserved 1; // was record_time
// the time until when future commands with the same
// deduplication key will be rejected due to a duplicate submission
google.protobuf.Timestamp deduplicated_until = 2;
}
message DamlSubmissionDedupKey {
enum SubmissionKind {
PARTY_ALLOCATION = 0;
PACKAGE_UPLOAD = 1;
CONFIGURATION = 2;
}
SubmissionKind submission_kind = 1;
// A unique string scoped to a particular participant.
string submission_id = 2;
// Uploading participant's id.
string participant_id = 3;
}
message DamlSubmissionDedupValue {
reserved 1; // was record_time
}
// Daml contract state, recording the activeness state of a contract.
// The contract instance itself is stored within the transaction in a log entry.
// See https://github.com/digital-asset/daml/issues/734 for future work on contract
// instance storage.
message DamlContractState {
// The time from which the contract is active.
// This is the same value as the ledger_effective_time of the transaction
// that created this contract.
google.protobuf.Timestamp active_at = 1;
// Optional, if set the contract has been archived.
google.protobuf.Timestamp archived_at = 2;
reserved 3; // was archived_by_entry
// The parties to which this contract has been explicitly disclosed, that is,
// the parties which witnessed the creation of the contract.
repeated string locally_disclosed_to = 4;
// The parties to which this contract has been disclosed to after the creation
// of the contract (i.e. divulged to).
// https://docs.daml.com/concepts/ledger-model/ledger-privacy.html#divulgence-when-non-stakeholders-see-contracts
repeated string divulged_to = 5;
// The contract key set by the contract. Optional.
DamlContractKey contract_key = 6;
// The contract instance.
com.daml.lf.transaction.ContractInstance contract_instance = 7;
}
message DamlContractKey {
// The Daml template identifier of the contract that created this key.
com.daml.lf.value.Identifier template_id = 1;
reserved 2; // This was key serialized as a VersionedValue. Replaced by hash.
// Hash of the contract key value, produced by KeyHasher.
bytes hash = 3;
}
// Stored information about a given party.
// Party tenancy is immutable and cannot change once recorded.
// TODO: Add concept of party allocation time. It would have to follow similar pattern
// as LET for transactions, so that party allocation submissions remain verifiable by
// the committers/validators.
message DamlPartyAllocation {
// Id of participant where the party is hosted.
string participant_id = 1;
// A display name associated with the given party.
string display_name = 2;
}
// The state of a contract key.
message DamlContractKeyState {
// The contract to which the key points to.
// If unset the key is inactive.
string contract_id = 1;
// The time from which the contract is active.
// This is the same value as the ledger_effective_time of the transaction
// that created this contract.
google.protobuf.Timestamp active_at = 2;
}
// Errors
//
@ -598,7 +455,7 @@ message InconsistentKeys {
message InconsistentContracts {
}
message MissingInputState {
DamlStateKey key = 1;
com.daml.ledger.participant.state.kvutils.store.DamlStateKey key = 1;
}
message InvalidParticipantState {
string details = 1;

View File

@ -0,0 +1,29 @@
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package com.daml.ledger.participant.state.kvutils.store.events;
option java_package = "com.daml.ledger.participant.state.kvutils.store.events";
option java_multiple_files = true;
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store.Events";
import "com/daml/ledger/configuration/ledger_configuration.proto";
// This message is in it's own file because `state.proto` depends on this message,
// and it would introduce a circular dependency if kept in `daml_kvutils.proto`
// Configuration entry that records a configuration change.
// Also used in state to look up latest configuration.
// When a configuration exists, only the participant that
// submitted previously can change it.
message DamlConfigurationEntry {
// The submission from which this configuration originated.
string submission_id = 1;
// Submitting participant's id.
string participant_id = 2;
// The ledger configuration.
com.daml.ledger.configuration.LedgerConfiguration configuration = 3;
}

View File

@ -0,0 +1,145 @@
// Copyright (c) 2021 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
syntax = "proto3";
package com.daml.ledger.participant.state.kvutils.store;
option java_package = "com.daml.ledger.participant.state.kvutils.store";
option java_multiple_files = true;
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Store";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "com/daml/daml_lf_dev/daml_lf.proto";
import "com/daml/ledger/participant/state/kvutils/store/events/configuration.proto";
import "com/daml/lf/transaction.proto";
import "com/daml/lf/value.proto";
// Daml state key. [[KeyValueCommitting]] produces effects that are committed
// to the ledger from the `DamlSubmission`: a log entry to be created, and
// the set of Daml state updates.
// The field numbers below must match with the corresponding entries in `DamlStateValue`.
message DamlStateKey {
oneof key {
string package_id = 1;
string contract_id = 2;
DamlCommandDedupKey command_dedup = 3;
string party = 4;
DamlContractKey contract_key = 5;
google.protobuf.Empty configuration = 6;
DamlSubmissionDedupKey submission_dedup = 7;
}
}
// Daml state values pointed to by `DamlStateKey`.
// The field numbers below must match with the corresponding entries in `DamlStateKey`.
message DamlStateValue {
oneof value {
daml_lf_dev.Archive archive = 1;
DamlContractState contract_state = 2;
DamlCommandDedupValue command_dedup = 3;
DamlPartyAllocation party = 4;
DamlContractKeyState contract_key_state = 5;
com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry configuration_entry = 6;
DamlSubmissionDedupValue submission_dedup = 7;
}
}
message DamlCommandDedupKey {
repeated string submitters = 1;
string application_id = 2;
string command_id = 3;
}
message DamlCommandDedupValue {
reserved 1; // was record_time
// the time until when future commands with the same
// deduplication key will be rejected due to a duplicate submission
google.protobuf.Timestamp deduplicated_until = 2;
}
message DamlSubmissionDedupKey {
enum SubmissionKind {
PARTY_ALLOCATION = 0;
PACKAGE_UPLOAD = 1;
CONFIGURATION = 2;
}
SubmissionKind submission_kind = 1;
// A unique string scoped to a particular participant.
string submission_id = 2;
// Uploading participant's id.
string participant_id = 3;
}
message DamlSubmissionDedupValue {
reserved 1; // was record_time
}
// Daml contract state, recording the activeness state of a contract.
// The contract instance itself is stored within the transaction in a log entry.
// See https://github.com/digital-asset/daml/issues/734 for future work on contract
// instance storage.
message DamlContractState {
// The time from which the contract is active.
// This is the same value as the ledger_effective_time of the transaction
// that created this contract.
google.protobuf.Timestamp active_at = 1;
// Optional, if set the contract has been archived.
google.protobuf.Timestamp archived_at = 2;
reserved 3; // was archived_by_entry
// The parties to which this contract has been explicitly disclosed, that is,
// the parties which witnessed the creation of the contract.
repeated string locally_disclosed_to = 4;
// The parties to which this contract has been disclosed to after the creation
// of the contract (i.e. divulged to).
// https://docs.daml.com/concepts/ledger-model/ledger-privacy.html#divulgence-when-non-stakeholders-see-contracts
repeated string divulged_to = 5;
// The contract key set by the contract. Optional.
DamlContractKey contract_key = 6;
// The contract instance.
com.daml.lf.transaction.ContractInstance contract_instance = 7;
}
message DamlContractKey {
// The Daml template identifier of the contract that created this key.
com.daml.lf.value.Identifier template_id = 1;
reserved 2; // This was key serialized as a VersionedValue. Replaced by hash.
// Hash of the contract key value, produced by KeyHasher.
bytes hash = 3;
}
// Stored information about a given party.
// Party tenancy is immutable and cannot change once recorded.
// TODO: Add concept of party allocation time. It would have to follow similar pattern
// as LET for transactions, so that party allocation submissions remain verifiable by
// the committers/validators.
message DamlPartyAllocation {
// Id of participant where the party is hosted.
string participant_id = 1;
// A display name associated with the given party.
string display_name = 2;
}
// The state of a contract key.
message DamlContractKeyState {
// The contract to which the key points to.
// If unset the key is inactive.
string contract_id = 1;
// The time from which the contract is active.
// This is the same value as the ledger_effective_time of the transaction
// that created this contract.
google.protobuf.Timestamp active_at = 2;
}

View File

@ -8,12 +8,13 @@ option java_multiple_files = true;
option csharp_namespace = "Com.Daml.Ledger.Participant.State.KVUtils.Wire";
import "com/daml/ledger/participant/state/kvutils/daml_kvutils.proto";
import "com/daml/ledger/participant/state/kvutils/store/state.proto";
// A submission to the ledger: a payload and its inputs if any.
// Produced by [[KeyValueSubmission]].
// Transformed into `DamlLogEntry` when committed.
message DamlSubmission {
repeated DamlStateKey input_daml_state = 1;
repeated com.daml.ledger.participant.state.kvutils.store.DamlStateKey input_daml_state = 1;
oneof payload {
DamlTransactionEntry transaction_entry = 2;
DamlPackageUploadEntry package_upload_entry = 3;

View File

@ -3,6 +3,9 @@
package com.daml.ledger.participant.state.kvutils
import java.io.StringWriter
import java.time.{Duration, Instant}
import com.daml.ledger.api.DeduplicationPeriod
import com.daml.ledger.grpc.GrpcStatuses
import com.daml.ledger.offset.Offset
@ -17,6 +20,12 @@ import com.daml.ledger.participant.state.kvutils.committer.transaction.Rejection
ExternallyInconsistentTransaction,
InternallyInconsistentTransaction,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlCommandDedupKey,
DamlContractKey,
DamlStateKey,
DamlSubmissionDedupKey,
}
import com.daml.ledger.participant.state.v2.Update.CommandRejected.FinalReason
import com.daml.ledger.participant.state.v2.{CompletionInfo, SubmitterInfo}
import com.daml.lf.data.Relation.Relation
@ -32,8 +41,6 @@ import com.google.rpc.code.Code
import com.google.rpc.error_details.ErrorInfo
import com.google.rpc.status.Status
import java.io.StringWriter
import java.time.{Duration, Instant}
import scala.annotation.nowarn
import scala.collection.mutable
import scala.jdk.CollectionConverters._

View File

@ -5,6 +5,7 @@ package com.daml.ledger.participant.state.kvutils
import java.util.zip.{GZIPInputStream, GZIPOutputStream}
import com.daml.ledger.participant.state.kvutils.store.DamlStateValue
import com.daml.ledger.participant.state.kvutils.{DamlKvutils => Proto}
import com.google.protobuf.ByteString
@ -22,7 +23,7 @@ object Envelope {
final case class LogEntryMessage(logEntry: Proto.DamlLogEntry) extends Message
final case class StateValueMessage(value: Proto.DamlStateValue) extends Message
final case class StateValueMessage(value: DamlStateValue) extends Message
final case class SubmissionBatchMessage(value: wire.DamlSubmissionBatch) extends Message
@ -59,10 +60,10 @@ object Envelope {
def enclose(logEntry: Proto.DamlLogEntry, compression: Boolean): Raw.Envelope =
enclose(Proto.Envelope.MessageKind.LOG_ENTRY, logEntry.toByteString, compression)
def enclose(stateValue: Proto.DamlStateValue): Raw.Envelope =
def enclose(stateValue: DamlStateValue): Raw.Envelope =
enclose(stateValue, compression = DefaultCompression)
def enclose(stateValue: Proto.DamlStateValue, compression: Boolean): Raw.Envelope =
def enclose(stateValue: DamlStateValue, compression: Boolean): Raw.Envelope =
enclose(Proto.Envelope.MessageKind.STATE_VALUE, stateValue.toByteString, compression)
def enclose(batch: wire.DamlSubmissionBatch): Raw.Envelope =
@ -98,7 +99,7 @@ object Envelope {
parseMessageSafe(() => wire.DamlSubmission.parseFrom(uncompressedMessage))
.map(SubmissionMessage)
case Proto.Envelope.MessageKind.STATE_VALUE =>
parseMessageSafe(() => Proto.DamlStateValue.parseFrom(uncompressedMessage))
parseMessageSafe(() => DamlStateValue.parseFrom(uncompressedMessage))
.map(StateValueMessage)
case Proto.Envelope.MessageKind.SUBMISSION_BATCH =>
parseMessageSafe(() => wire.DamlSubmissionBatch.parseFrom(uncompressedMessage))
@ -126,13 +127,13 @@ object Envelope {
case msg => Left(s"Expected submission, got ${msg.getClass}")
}
def openStateValue(envelopeBytes: Raw.Envelope): Either[String, Proto.DamlStateValue] =
def openStateValue(envelopeBytes: Raw.Envelope): Either[String, DamlStateValue] =
open(envelopeBytes).flatMap {
case StateValueMessage(entry) => Right(entry)
case msg => Left(s"Expected state value, got ${msg.getClass}")
}
def openStateValue(envelopeBytes: Array[Byte]): Either[String, Proto.DamlStateValue] =
def openStateValue(envelopeBytes: Array[Byte]): Either[String, DamlStateValue] =
open(envelopeBytes).flatMap {
case StateValueMessage(entry) => Right(entry)
case msg => Left(s"Expected state value, got ${msg.getClass}")

View File

@ -3,7 +3,7 @@
package com.daml.ledger.participant.state.kvutils
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.lf.data.Ref
/** Errors thrown by kvutils.

View File

@ -15,6 +15,11 @@ import com.daml.ledger.participant.state.kvutils.committer.{
PartyAllocationCommitter,
SubmissionExecutor,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractKey,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.Ref
import com.daml.lf.data.Time.Timestamp

View File

@ -7,6 +7,7 @@ import com.daml.ledger.configuration.Configuration
import com.daml.ledger.grpc.GrpcStatuses
import com.daml.ledger.participant.state.kvutils.Conversions._
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.v2.Update.CommandRejected.FinalReason
import com.daml.ledger.participant.state.v2.{DivulgedContract, TransactionMeta, Update}
import com.daml.lf.data.Ref

View File

@ -7,6 +7,7 @@ import com.daml.daml_lf_dev.DamlLf.Archive
import com.daml.ledger.configuration.Configuration
import com.daml.ledger.participant.state.kvutils.Conversions._
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.v2.{SubmitterInfo, TransactionMeta}
import com.daml.lf.data.Ref

View File

@ -3,7 +3,8 @@
package com.daml.ledger.participant.state.kvutils
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlLogEntryId, DamlStateKey}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlLogEntryId
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.google.protobuf.ByteString
object Raw {

View File

@ -5,11 +5,8 @@ package com.daml.ledger.participant.state.kvutils.committer
import java.time.Instant
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlLogEntry
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{DamlStateMap, Err}
import com.daml.lf.data.Ref
import com.daml.lf.data.Time.Timestamp

View File

@ -7,14 +7,13 @@ import com.codahale.metrics.Timer
import com.daml.ledger.configuration.Configuration
import com.daml.ledger.participant.state.kvutils.Conversions.buildTimestamp
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlConfigurationEntry,
DamlLogEntry,
DamlOutOfTimeBoundsEntry,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils._
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.Time.Timestamp
import com.daml.lf.data.{Ref, Time}

View File

@ -11,6 +11,8 @@ import com.daml.ledger.participant.state.kvutils.Conversions.{
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer._
import com.daml.ledger.participant.state.kvutils.store.{DamlStateValue, DamlSubmissionDedupValue}
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.Time.Timestamp
import com.daml.logging.entries.LoggingEntries

View File

@ -10,6 +10,11 @@ import com.daml.ledger.participant.state.kvutils.Conversions.packageUploadDedupK
import com.daml.ledger.participant.state.kvutils.DamlKvutils
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer.buildLogEntryWithOptionalRecordTime
import com.daml.ledger.participant.state.kvutils.store.{
DamlStateKey,
DamlStateValue,
DamlSubmissionDedupValue,
}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf
import com.daml.lf.data.Ref

View File

@ -6,6 +6,12 @@ package com.daml.ledger.participant.state.kvutils.committer
import com.daml.ledger.participant.state.kvutils.Conversions.partyAllocationDedupKey
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.Committer.buildLogEntryWithOptionalRecordTime
import com.daml.ledger.participant.state.kvutils.store.{
DamlPartyAllocation,
DamlStateKey,
DamlStateValue,
DamlSubmissionDedupValue,
}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.Ref
import com.daml.lf.data.Time.Timestamp

View File

@ -3,13 +3,10 @@
package com.daml.ledger.participant.state.kvutils.committer
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlLogEntry
import com.daml.ledger.participant.state.kvutils.DamlStateMap
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.{Ref, Time}
import com.daml.logging.LoggingContext

View File

@ -6,8 +6,8 @@ package com.daml.ledger.participant.state.kvutils.committer.transaction
import java.time.Instant
import com.daml.ledger.configuration.LedgerTimeModel
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.Err
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.lf
import com.daml.lf.data.Ref

View File

@ -18,6 +18,13 @@ import com.daml.ledger.participant.state.kvutils.committer.transaction.validatio
ModelConformanceValidator,
TransactionConsistencyValidator,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlCommandDedupValue,
DamlContractKeyState,
DamlContractState,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.kvutils.{Conversions, Err}
import com.daml.lf.data.Ref.Party

View File

@ -8,7 +8,6 @@ import com.daml.ledger.participant.state.kvutils.Conversions.{
packageStateKey,
parseTimestamp,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlContractState, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.committer.transaction.{
DamlTransactionEntrySummary,
Rejection,
@ -16,6 +15,7 @@ import com.daml.ledger.participant.state.kvutils.committer.transaction.{
Step,
}
import com.daml.ledger.participant.state.kvutils.committer.{CommitContext, StepContinue, StepResult}
import com.daml.ledger.participant.state.kvutils.store.{DamlContractState, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Conversions, Err}
import com.daml.lf.archive
import com.daml.lf.data.Ref.PackageId

View File

@ -4,12 +4,6 @@
package com.daml.ledger.participant.state.kvutils.committer.transaction.validation
import com.daml.ledger.participant.state.kvutils.Conversions
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlContractKey,
DamlContractKeyState,
DamlContractState,
DamlStateKey,
}
import com.daml.ledger.participant.state.kvutils.committer.transaction.{
DamlTransactionEntrySummary,
Rejection,
@ -17,6 +11,12 @@ import com.daml.ledger.participant.state.kvutils.committer.transaction.{
Step,
}
import com.daml.ledger.participant.state.kvutils.committer.{CommitContext, StepContinue, StepResult}
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractKey,
DamlContractKeyState,
DamlContractState,
DamlStateKey,
}
import com.daml.lf.transaction.Transaction.{
DuplicateKeys,
InconsistentKeys,

View File

@ -3,7 +3,7 @@
package com.daml.ledger.participant.state
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.metrics.MetricName
/** The participant-state key-value utilities provide methods to succinctly implement

View File

@ -3,13 +3,9 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlLogEntryId,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlLogEntry, DamlLogEntryId}
import com.daml.ledger.participant.state.kvutils.export.SubmissionAggregator
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.lf.data.Ref
import com.daml.logging.LoggingContext

View File

@ -3,8 +3,8 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
/** Default state key serialization strategy that does not prefix keys.
*/

View File

@ -3,13 +3,9 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlLogEntryId,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlLogEntry, DamlLogEntryId}
import com.daml.ledger.participant.state.kvutils.export.SubmissionAggregator
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Envelope, Raw}
import com.daml.lf.data.Ref
import com.daml.logging.LoggingContext

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Envelope, Raw}
import com.daml.ledger.validator.reading.{DamlLedgerStateReader, LedgerStateReader}
import com.daml.logging.LoggingContext

View File

@ -3,8 +3,8 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
/** Determines how we namespace and serialize state keys.
*/

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Envelope, Raw}
import scala.collection.SortedMap

View File

@ -9,6 +9,7 @@ import com.codahale.metrics.Timer
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.wire._
import com.daml.ledger.participant.state.kvutils.api.LedgerReader
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{DamlStateMap, Envelope, KeyValueCommitting, Raw}
import com.daml.ledger.validator.SubmissionValidator._
import com.daml.ledger.validator.ValidationFailed.{MissingInputState, ValidationError}

View File

@ -16,6 +16,7 @@ import com.daml.ledger.participant.state.kvutils.export.{
SubmissionAggregator,
SubmissionInfo,
}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{CorrelationId, Envelope, KeyValueCommitting, Raw}
import com.daml.ledger.validator
import com.daml.ledger.validator.SubmissionValidator.LogEntryAndState

View File

@ -4,8 +4,8 @@
package com.daml.ledger.validator.batch
import com.daml.caching.Cache
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.validator.caching.{
CacheUpdatePolicy,
CachingCommitStrategy,

View File

@ -7,8 +7,8 @@ import java.time.Instant
import akka.stream.Materializer
import com.daml.caching.Cache
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.v2.SubmissionResult
import com.daml.ledger.validator._
import com.daml.ledger.validator.caching.{CacheUpdatePolicy, ImmutablesOnlyCacheUpdatePolicy}

View File

@ -3,12 +3,9 @@
package com.daml.ledger.validator.batch
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlLogEntry
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlLogEntry.PayloadCase._
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.lf.value.ValueCoder
import com.daml.logging.{ContextualizedLogger, LoggingContext}
import com.daml.metrics.Metrics

View File

@ -5,8 +5,8 @@ package com.daml.ledger.validator.caching
import com.daml.caching.Cache
import com.daml.ledger.participant.state.kvutils.DamlKvutils
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.export.SubmissionAggregator
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.validator.{
CommitStrategy,
LedgerStateOperations,

View File

@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
package com.daml.ledger.validator.caching
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
/** Cache update policy that allows writing to-be-committed packages back to the cache and read
* immutable values such as packages and party allocations from the ledger.

View File

@ -4,8 +4,8 @@
package com.daml.ledger
import com.daml.caching.ConcurrentCache
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateValue
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.DamlStateValue
import com.daml.lf.data.Ref
import scala.concurrent.{ExecutionContext, Future}

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator.preexecution
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
final class KeyNotPresentInInputException(key: DamlStateKey)
extends IllegalStateException(

View File

@ -3,9 +3,9 @@
package com.daml.ledger.validator.preexecution
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.kvutils.api.LedgerReader
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.kvutils.{Envelope, KeyValueCommitting, Raw}
import com.daml.ledger.validator.reading.StateReader
import com.daml.ledger.validator.{

View File

@ -5,13 +5,13 @@ package com.daml.ledger.validator.preexecution
import java.time.Instant
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.export.{
LedgerDataExporter,
SubmissionAggregatorWriteOperations,
SubmissionInfo,
}
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.v2.SubmissionResult
import com.daml.ledger.validator.reading.{LedgerStateReader, StateReader}
import com.daml.ledger.validator.{

View File

@ -3,12 +3,8 @@
package com.daml.ledger.validator.preexecution
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlLogEntryId,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlLogEntry, DamlLogEntryId}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Envelope, KeyValueCommitting, Raw}
import com.daml.ledger.validator.preexecution.RawPreExecutingCommitStrategy.{InputState, ReadSet}
import com.daml.ledger.validator.{

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateValue
import com.daml.ledger.participant.state.kvutils.store.DamlStateValue
/** This typeclass signifies that implementor contains an optional Daml state value.
*

View File

@ -3,8 +3,8 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
package object reading {

View File

@ -11,6 +11,7 @@ import com.daml.ledger.api.DeduplicationPeriod
import com.daml.ledger.configuration.{Configuration, LedgerTimeModel}
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.v2.{SubmitterInfo, TransactionMeta}
import com.daml.ledger.test.SimplePackagePartyTestDar

View File

@ -7,6 +7,15 @@ import java.util.UUID
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.store.{
DamlCommandDedupKey,
DamlContractKey,
DamlContractKeyState,
DamlContractState,
DamlStateKey,
DamlStateValue,
DamlSubmissionDedupKey,
}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.Ref
import com.daml.lf.value.ValueOuterClass.Identifier

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator.preexecution
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.validator.HasDamlStateValue
import com.daml.ledger.validator.reading.StateReader
import com.daml.logging.LoggingContext

View File

@ -3,15 +3,18 @@
package com.daml.ledger.participant.state.kvutils
import java.time.{Duration, Instant}
import com.daml.ledger.api.DeduplicationPeriod
import com.daml.ledger.configuration.LedgerTimeModel
import com.daml.ledger.participant.state.kvutils.Conversions.{partyStateKey, _}
import com.daml.ledger.participant.state.kvutils.Conversions._
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlTransactionBlindingInfo.{
DisclosureEntry,
DivulgenceEntry,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.committer.transaction.Rejection
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.v2.Update.CommandRejected
import com.daml.lf.crypto
import com.daml.lf.crypto.Hash
@ -32,7 +35,6 @@ import org.scalatest.matchers.should.Matchers
import org.scalatest.prop.TableDrivenPropertyChecks.{Table, forAll}
import org.scalatest.wordspec.AnyWordSpec
import java.time.{Duration, Instant}
import scala.annotation.nowarn
import scala.collection.immutable.{ListMap, ListSet}
import scala.collection.mutable

View File

@ -3,6 +3,7 @@
package com.daml.ledger.participant.state.kvutils
import com.daml.ledger.participant.state.kvutils.store.DamlStateValue
import com.daml.ledger.participant.state.kvutils.wire._
import com.daml.ledger.participant.state.kvutils.{DamlKvutils => Proto}
import com.google.protobuf.ByteString
@ -22,7 +23,7 @@ class EnvelopeSpec extends AnyWordSpec with Matchers {
Envelope.open(Envelope.enclose(logEntry)) shouldEqual
Right(Envelope.LogEntryMessage(logEntry))
val stateValue = Proto.DamlStateValue.getDefaultInstance
val stateValue = DamlStateValue.getDefaultInstance
Envelope.open(Envelope.enclose(stateValue)) shouldEqual
Right(Envelope.StateValueMessage(stateValue))
}

View File

@ -10,6 +10,7 @@ import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlTransactionRejectionEntry,
}
import com.daml.ledger.participant.state.kvutils.TestHelpers._
import com.daml.ledger.participant.state.kvutils.store.DamlStateValue
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.v2.Update
import com.daml.ledger.test._
@ -487,10 +488,10 @@ class KVUtilsTransactionSpec extends AnyWordSpec with Matchers with Inside {
// Check that all contracts and keys are in the archived state.
finalState.damlState.foreach { case (_, v) =>
v.getValueCase match {
case DamlKvutils.DamlStateValue.ValueCase.CONTRACT_KEY_STATE =>
case DamlStateValue.ValueCase.CONTRACT_KEY_STATE =>
v.getContractKeyState.getContractId shouldBe Symbol("empty")
case DamlKvutils.DamlStateValue.ValueCase.CONTRACT_STATE =>
case DamlStateValue.ValueCase.CONTRACT_STATE =>
val cs = v.getContractState
cs.hasArchivedAt shouldBe true

View File

@ -4,10 +4,11 @@
package com.daml.ledger.participant.state.kvutils
import java.time.Duration
import com.codahale.metrics.MetricRegistry
import com.daml.ledger.api.{DeduplicationPeriod => ApiDeduplicationPeriod}
import com.daml.ledger.configuration.{Configuration, LedgerTimeModel}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlCommandDedupKey, DamlStateKey}
import com.daml.ledger.participant.state.kvutils.store.{DamlCommandDedupKey, DamlStateKey}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.v2.{SubmitterInfo, TransactionMeta}
import com.daml.lf.crypto

View File

@ -4,6 +4,7 @@
package com.daml.ledger.participant.state.kvutils
import java.time.Instant
import com.daml.ledger.configuration.Configuration
import com.daml.ledger.grpc.GrpcStatuses
import com.daml.ledger.participant.state.kvutils.Conversions.{buildTimestamp, parseInstant}
@ -15,6 +16,7 @@ import com.daml.ledger.participant.state.kvutils.KeyValueConsumption.{
outOfTimeBoundsEntryToUpdate,
}
import com.daml.ledger.participant.state.kvutils.api.LedgerReader
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.v2.Update
import com.daml.ledger.participant.state.v2.Update.CommandRejected
import com.daml.ledger.participant.state.v2.Update.CommandRejected.FinalReason

View File

@ -11,6 +11,7 @@ import com.daml.ledger.offset.Offset
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.api.KeyValueParticipantStateReader.offsetForUpdate
import com.daml.ledger.participant.state.kvutils.api.KeyValueParticipantStateReaderSpec._
import com.daml.ledger.participant.state.kvutils.store.{DamlPartyAllocation, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Envelope, OffsetBuilder, Raw}
import com.daml.ledger.participant.state.v2.Update
import com.daml.lf.data.Ref

View File

@ -3,12 +3,12 @@
package com.daml.ledger.participant.state.kvutils.committer
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
import com.daml.ledger.participant.state.kvutils.committer.CommitContextSpec._
import com.daml.ledger.participant.state.kvutils.store.{
DamlPartyAllocation,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.committer.CommitContextSpec._
import com.daml.ledger.participant.state.kvutils.{DamlStateMap, Err, TestHelpers}
import com.daml.lf.data.Time
import com.daml.logging.LoggingContext

View File

@ -14,6 +14,8 @@ import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.Err
import com.daml.ledger.participant.state.kvutils.TestHelpers.{createCommitContext, theDefaultConfig}
import com.daml.ledger.participant.state.kvutils.committer.CommitterSpec._
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.data.Ref
import com.daml.lf.data.Time.Timestamp

View File

@ -10,6 +10,7 @@ import com.daml.daml_lf_dev.DamlLf
import com.daml.ledger.participant.state.kvutils.Conversions.buildTimestamp
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.TestHelpers._
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.lf.archive.Decode
import com.daml.lf.archive.testing.Encode

View File

@ -12,9 +12,16 @@ import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.Err.MissingInputState
import com.daml.ledger.participant.state.kvutils.TestHelpers._
import com.daml.ledger.participant.state.kvutils.committer.{CommitContext, StepContinue, StepStop}
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.kvutils.store.{
DamlCommandDedupValue,
DamlPartyAllocation,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.{Conversions, Err, committer}
import com.daml.lf.data.{ImmArray, Ref}
import com.daml.lf.data.Time.Timestamp
import com.daml.lf.data.{ImmArray, Ref}
import com.daml.lf.engine.Engine
import com.daml.lf.transaction._
import com.daml.lf.transaction.test.TransactionBuilder
@ -42,9 +49,8 @@ class TransactionCommitterSpec
with Matchers
with MockitoSugar
with OptionValues {
import TransactionCommitterSpec._
import TransactionBuilder.Implicits._
import TransactionCommitterSpec._
private implicit val loggingContext: LoggingContext = LoggingContext.ForTesting

View File

@ -9,11 +9,6 @@ import com.codahale.metrics.MetricRegistry
import com.daml.ledger.configuration.Configuration
import com.daml.ledger.participant.state.kvutils.Conversions
import com.daml.ledger.participant.state.kvutils.Conversions.configurationStateKey
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlCommandDedupValue,
DamlConfigurationEntry,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.TestHelpers.{
createCommitContext,
createEmptyTransactionEntry,
@ -24,6 +19,8 @@ import com.daml.ledger.participant.state.kvutils.committer.transaction.{
Rejections,
}
import com.daml.ledger.participant.state.kvutils.committer.{StepContinue, StepStop}
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.kvutils.store.{DamlCommandDedupValue, DamlStateValue}
import com.daml.lf.data.Time.Timestamp
import com.daml.logging.LoggingContext
import com.daml.metrics.Metrics

View File

@ -4,6 +4,7 @@
package com.daml.ledger.participant.state.kvutils.committer.transaction.validation
import java.time.{Instant, ZoneOffset, ZonedDateTime}
import com.codahale.metrics.MetricRegistry
import com.daml.daml_lf_dev.DamlLf
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
@ -13,6 +14,11 @@ import com.daml.ledger.participant.state.kvutils.committer.transaction.{
Rejections,
}
import com.daml.ledger.participant.state.kvutils.committer.{StepContinue, StepStop}
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractState,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.{Conversions, Err}
import com.daml.ledger.validator.TestHelper.{makeContractIdStateKey, makeContractIdStateValue}
import com.daml.lf.archive.testing.Encode

View File

@ -24,6 +24,13 @@ import com.daml.ledger.participant.state.kvutils.committer.{
StepResult,
StepStop,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractKey,
DamlContractKeyState,
DamlContractState,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.validator.TestHelper.{makeContractIdStateKey, makeContractIdStateValue}
import com.daml.lf.data.{ImmArray, Ref}
import com.daml.lf.transaction.SubmittedTransaction

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.{Envelope, Raw}
import com.daml.ledger.validator.ArgumentMatchers.{anyExecutionContext, anyLoggingContext}
import com.daml.ledger.validator.LogAppendingCommitStrategySpec._

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
import com.daml.ledger.participant.state.kvutils.store.{
DamlPartyAllocation,
DamlStateKey,
DamlStateValue,

View File

@ -8,6 +8,7 @@ import java.time.Clock
import com.codahale.metrics.MetricRegistry
import com.daml.caching.Cache
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.{DamlSubmission, DamlSubmissionBatch}
import com.daml.ledger.participant.state.kvutils.{Envelope, KeyValueCommitting, Raw}
import com.daml.ledger.validator.ArgumentMatchers.{anyExecutionContext, anyLoggingContext}

View File

@ -12,6 +12,7 @@ import com.daml.ledger.participant.state.kvutils.export.{
NoOpLedgerDataExporter,
SubmissionAggregator,
}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmissionBatch.CorrelatedSubmission
import com.daml.ledger.participant.state.kvutils.wire._
import com.daml.ledger.participant.state.kvutils.{Envelope, KeyValueCommitting, Raw}

View File

@ -5,6 +5,12 @@ package com.daml.ledger.validator.batch
import com.codahale.metrics.MetricRegistry
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractKey,
DamlPartyAllocation,
DamlStateKey,
DamlStateValue,
}
import com.daml.lf.value.ValueOuterClass
import com.daml.logging.LoggingContext
import com.daml.metrics.Metrics

View File

@ -4,14 +4,10 @@
package com.daml.ledger.validator.caching
import com.daml.caching.{Cache, WeightedCache}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlLogEntry,
DamlLogEntryId,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{DamlLogEntry, DamlLogEntryId}
import com.daml.ledger.participant.state.kvutils.caching.`Message Weight`
import com.daml.ledger.participant.state.kvutils.export.SubmissionAggregator
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.validator.CommitStrategy
import com.daml.ledger.validator.TestHelper._
import com.daml.ledger.validator.caching.CachingCommitStrategySpec._

View File

@ -3,7 +3,7 @@
package com.daml.ledger.validator.caching
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.validator.TestHelper
import org.scalatest.matchers.should.Matchers
import org.scalatest.wordspec.AnyWordSpec

View File

@ -9,8 +9,9 @@ import com.codahale.metrics.MetricRegistry
import com.daml.ledger.configuration.Configuration
import com.daml.ledger.participant.state.kvutils.DamlKvutils._
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils.wire.{DamlSubmission, DamlSubmissionBatch}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmissionBatch.CorrelatedSubmission
import com.daml.ledger.participant.state.kvutils.wire.{DamlSubmission, DamlSubmissionBatch}
import com.daml.ledger.participant.state.kvutils.{
DamlStateMap,
Envelope,

View File

@ -4,13 +4,13 @@ package com.daml.ledger.validator.preexecution
import java.time.Instant
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateKey
import com.daml.ledger.participant.state.kvutils.Raw
import com.daml.ledger.participant.state.kvutils.`export`.{
LedgerDataExporter,
SubmissionAggregator,
SubmissionInfo,
}
import com.daml.ledger.participant.state.kvutils.store.DamlStateKey
import com.daml.ledger.participant.state.v2.SubmissionResult
import com.daml.ledger.validator.TestHelper.{FakeStateAccess, aParticipantId}
import com.daml.ledger.validator.reading.StateReader

View File

@ -4,13 +4,15 @@
package com.daml.ledger.validator.preexecution
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlContractState,
DamlLogEntry,
DamlPartyAllocationRejectionEntry,
}
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils.store.{
DamlContractState,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting.PreExecutionResult
import com.daml.ledger.participant.state.kvutils.{DamlKvutils, Raw}
import com.daml.ledger.validator.StateKeySerializationStrategy
import com.daml.ledger.validator.TestHelper.{

View File

@ -8,13 +8,13 @@ import java.util.concurrent.atomic.AtomicReference
import akka.stream.Materializer
import com.daml.ledger.on.memory.{InMemoryLedgerStateAccess, InMemoryState, Index}
import com.daml.ledger.participant.state.kvutils.DamlKvutils.DamlStateValue
import com.daml.ledger.participant.state.kvutils.KeyValueCommitting
import com.daml.ledger.participant.state.kvutils.export.{
NoOpLedgerDataExporter,
SubmissionInfo,
WriteSet,
}
import com.daml.ledger.participant.state.kvutils.store.DamlStateValue
import com.daml.ledger.validator.preexecution.{
EqualityBasedPostExecutionConflictDetector,
PreExecutingSubmissionValidator,

View File

@ -5,6 +5,7 @@ package com.daml.ledger.participant.state.kvutils.tools.integritycheck
import com.daml.ledger.participant.state.kvutils
import com.daml.ledger.participant.state.kvutils.export.WriteSet
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlStateValue}
import com.daml.ledger.participant.state.kvutils.tools.integritycheck.WriteSetComparison._
import com.daml.ledger.participant.state.kvutils.{DamlKvutils, Envelope, Raw}
import com.daml.ledger.validator.StateKeySerializationStrategy
@ -129,7 +130,7 @@ final class RawWriteSetComparison(stateKeySerializationStrategy: StateKeySeriali
rawEnvelope: Raw.Envelope,
): Either[String, Either[
(DamlKvutils.DamlLogEntryId, DamlKvutils.DamlLogEntry),
(DamlKvutils.DamlStateKey, DamlKvutils.DamlStateValue),
(DamlStateKey, DamlStateValue),
]] =
Envelope.open(rawEnvelope) match {
case Left(errorMessage) =>
@ -142,9 +143,9 @@ final class RawWriteSetComparison(stateKeySerializationStrategy: StateKeySeriali
Right(Left(logEntryId -> logEntry))
case Right(Envelope.StateValueMessage(value)) =>
val key = stateKeySerializationStrategy.deserializeStateKey(Raw.StateKey(rawKey.bytes))
if (key.getKeyCase == DamlKvutils.DamlStateKey.KeyCase.KEY_NOT_SET)
if (key.getKeyCase == DamlStateKey.KeyCase.KEY_NOT_SET)
Left("State key not set.")
else if (value.getValueCase == DamlKvutils.DamlStateValue.ValueCase.VALUE_NOT_SET)
else if (value.getValueCase == DamlStateValue.ValueCase.VALUE_NOT_SET)
Left("State value not set.")
else
Right(Right(key -> value))

View File

@ -12,10 +12,9 @@ import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlConfigurationSubmission,
DamlLogEntry,
DamlPartyAllocationEntry,
DamlStateKey,
DamlSubmissionDedupKey,
}
import com.daml.ledger.participant.state.kvutils.export.{SubmissionInfo, WriteSet}
import com.daml.ledger.participant.state.kvutils.store.{DamlStateKey, DamlSubmissionDedupKey}
import com.daml.ledger.participant.state.kvutils.tools.integritycheck.RawPreExecutingCommitStrategySupportSpec._
import com.daml.ledger.participant.state.kvutils.wire.DamlSubmission
import com.daml.ledger.participant.state.kvutils.{Envelope, Raw}

View File

@ -5,14 +5,16 @@ package com.daml.ledger.participant.state.kvutils.tools.integritycheck
import com.daml.ledger.configuration.protobuf.LedgerConfiguration
import com.daml.ledger.participant.state.kvutils.DamlKvutils.{
DamlConfigurationEntry,
DamlLogEntry,
DamlLogEntryId,
DamlPartyAllocation,
DamlPartyAllocationEntry,
}
import com.daml.ledger.participant.state.kvutils.store.{
DamlPartyAllocation,
DamlStateKey,
DamlStateValue,
}
import com.daml.ledger.participant.state.kvutils.store.events.DamlConfigurationEntry
import com.daml.ledger.participant.state.kvutils.tools.integritycheck.RawWriteSetComparisonSpec._
import com.daml.ledger.participant.state.kvutils.tools.integritycheck.WriteSetComparison.rawHexString
import com.daml.ledger.participant.state.kvutils.{DamlKvutils, Envelope, Raw, Version}